【问题标题】:Compiling boost::move in gcc 4.6.4在 gcc 4.6.4 中编译 boost::move
【发布时间】:2013-12-02 13:24:51
【问题描述】:

我有一个使用 Boost::move 来移动锁的函数 -

/**
 * Moving assignment operator transfers ownership of the lock
 */
 const_iterator& operator=(const_iterator && other) {
    if (this != &other) {
        iter = other.iter;
        lock = boost::move(other.lock);
    }
    return *this;
 }

我可以使用带有 -std=c++11 或 -std=c++0x 标志的 gcc 4.7.3 编译此代码。但是,对于 gcc 4.6.4,即使使用 -std=c++0x 标志,此代码也会失败。有关如何解决此问题的任何想法?

用于使用 C++11 功能的 CMAKE 标志:

set(CMAKE_CXX_FLAGS "-std=c++11")

用于使用 C++0x 功能的 CMAKE 标志:

set(CMAKE_CXX_FLAGS "-std=c++0x")

我在 gcc 4.6.4 中遇到的错误:

错误:'iter!= ((indexing::skarf::SkarfDatabase*)this)->indexing::skarf::SkarfDatabase::bucketFinderIndex 中的 'operator!=' 不匹配。 indexing::skarf::BucketIDT::Finder

::end with P = features::Descriptor, T = long unsigned int’ /home/rahulg/ripe/src/index/skarf/SkarfDatabase.hpp:141:40:注意:候选人是:/usr/ local/include/boost/smart_ptr/shared_array.hpp:264:31: 注意:模板 bool boost::operator!=(boost::detail::sp_nullptr_t, const boost::shared_array&) /usr/local/include/boost/ smart_ptr/shared_array.hpp:259:31: 注意: 模板 bool boost::operator!=(const boost::shared_array&, boost::detail::sp_nullptr_t) /usr/local/include/boost/smart_ptr/shared_array.hpp: 242:31: 注意: 模板 bool boost::operator!=(const boost::shared_array&, const boost::shared_array&) /usr/local/include/boost/ptr_container/detail/void_ptr_iterator.hpp:185:21: 注意:模板 bool boost::operator!=(const boost::void_ptr_iterator&, const boost::void_ptr_iterator&) /usr/local/include/boost/blank.hpp:73:13: 注意:bool boost::operator!=(const boost ::blank&, const boost::blank&) /usr/local/include/boost/blank.hpp:73:13: 注意:从 ‘index 参数 1 没有已知的转换ing::skarf::BucketIDT::iterator 到 'const boost::blank&' /usr/local/include/boost/range/sub_range.hpp:161:17: 注意:模板 bool boost::operator !=(const boost::sub_range&, const boost::sub_range&) /usr/local/include/boost/function/function_template.hpp:1031:8: 注意:模板 void boost::operator!=(const boost::function10& , const boost::function10&) /usr/local/include/boost/function/function_template.hpp:1031:8: 注意:模板 void boost::operator!=(const boost::function9&, const boost::function9&) / usr/local/include/boost/function/function_template.hpp:1031:8: 注意:模板 void boost::operator!=(const boost::function8&, const boost::function8&) /usr/local/include/boost/ function/function_template.hpp:1031:8: 注意:模板 void boost::operator!=(const boost::function7&, const boost::function7&) /usr/local/include/boost/function/function_template.hpp:1031: 8:注意:模板 void boost::operator!=(const boost::function6&, const boost::function6&) /usr/local/include/boost/function /function_template.hpp:1031:8: 注意:模板 void boost::operator!=(const boost::function5&, const boost::function5&) /usr/local/include/boost/function/function_template.hpp:1031:8 : 注意: 模板 void boost::operator!=(const boost::function4&, const boost::function4&) /usr/local/include/boost/function/function_template.hpp:1031:8: 注意: 模板 void boost:: operator!=(const boost::function3&, const boost::function3&) /usr/local/include/boost/function/function_template.hpp:1031:8: 注意:模板 void boost::operator!=(const boost:: function2&, const boost::function2&) /usr/local/include/boost/function/function_template.hpp:1031:8: 注意:模板 void boost::operator!=(const boost::function0&, const boost::function0&) /usr/local/include/boost/function/function_template.hpp:1031:8: 注意:模板 void boost::operator!=(const boost::function1&, const boost::function1&) /usr/local/include/boost /function/function_base.hpp:872:3: 注意:模板类型名 boost::enable_if_c::value>::value, boo l>::type boost::operator!=(boost::reference_wrapper, const boost::function_base&) /usr/local/include/boost/function/function_base.hpp:863:3: 注意:模板类型名 boost::enable_if_c ::value>::value, bool>::type boost::operator!=(const boost::function_base&, boost::reference_wrapper) /usr/local/include/boost/function/function_base.hpp:835:3:注意:模板类型名 boost::enable_if_c::value>::value, bool>::type boost::operator!=(Functor, const boost::function_base&) /usr/local/include/boost/function/function_base.hpp :826:3: 注意:模板类型名 boost::enable_if_c::value>::value, bool>::type boost::operator!=(const boost::function_base&, Functor) /usr/local/include/boost/ function/function_base.hpp:764:13: 注意: bool boost::operator!=(boost::detail::function::useless_clear_type*, const boost::function_base&)

【问题讨论】:

标签: c++ boost c++11 boost-move


【解决方案1】:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-13
    • 2014-02-28
    • 2017-03-09
    • 1970-01-01
    • 2014-10-13
    相关资源
    最近更新 更多