在gcc 4.6.4中编译boost :: move

我有一个函数使用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;
 }

我可以使用gcc 4.7.3和-std = c ++ 11或-std = c ++ 0x标志来获得此代码。 但是,对于gcc 4.6.4,即使使用-std = c ++ 0x标志,该代码也会失败。 有想法该怎么解决这个吗?

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

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

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

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

我用gcc 4.6.4得到的错误:

错误:没有匹配'= operator!='in'iter!=((indexing :: skarf :: SkarfDatabase *)this) - > indexing :: skarf :: SkarfDatabase :: bucketFinderIndex.indexing :: skarf :: BucketIDT ::搜索

:: 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:note:template bool boost :: operator!=(boost :: detail :: sp_nullptr_t,const boost :: shared_array&)/ usr / local / include / boost / smart_ptr / shared_array .hpp:259:31:note:template bool boost :: operator!=(const boost :: shared_array&,boost :: detail :: sp_nullptr_t)/usr/local/include/boost/smart_ptr/shared_array.hpp:242:31 :note:template bool boost :: operator!=(const boost :: shared_array&,const boost :: shared_array&)/usr/local/include/boost/ptr_container/detail/void_ptr_iterator.hpp:185:21:note:template bool boost :: operator!=(const boost :: void_ptr_iterator&,const boost :: void_ptr_iterator&)/usr/local/include/boost/blank.hpp:73:13:note:bool boost :: operator!=(const boost :: blank& ,const boost :: blank&)/usr/local/include/boost/blank.hpp:73:13:注意:对于参数1没有已知的转换 indexing :: skarf :: BucketIDT :: iterator'toconst boost :: blank&'/usr/local/include/boost/range/sub_range.hpp:161:17:note:template bool boost :: operator !=(const boost :: sub_range&,const boost :: sub_range&)/usr/local/include/boost/function/function_template.hpp:1031:8:note:template void boost :: operator!=(const boost :: function10& ,const boost :: function10&)/usr/local/include/boost/function/function_template.hpp:1031:8:note:template void boost :: operator!=(const boost :: function9&,const boost :: function9&)/ / usr / local / include / boost / function / module_template.hpp:1031:8:note:template void boost :: operator!=(const boost :: function8&,const boost :: function8& function / function_template.hpp:1031:8:note:template void boost :: operator!=(const boost :: function7&,const boost :: function7&)/usr/local/include/boost/function/function_template.hpp:1031: 8:注意:template void boost :: operator!=(const boost :: function6&,const boost :: function6&)/ usr / local / in clude / boost / function / function_template.hpp:1031:8:note:template void boost :: operator!=(const boost :: function5&,const boost :: function5&)/ usr / local / include / boost / function / function_template。 hpp:1031:8:note:template void boost :: operator!=(const boost :: function4&,const boost :: function4&)/usr/local/include/boost/function/function_template.hpp:1031:8:note:模板void boost :: operator!=(const boost :: function3&,const boost :: function3&)/usr/local/include/boost/function/function_template.hpp:1031:8:note:template void boost :: operator!= (const boost :: function2&,const boost :: function2&)/usr/local/include/boost/function/function_template.hpp:1031:8:note:template void boost :: operator!=(const boost :: function0&,const boost :: function0&)/usr/local/include/boost/function/function_template.hpp:1031:8:note:template void boost :: operator!=(const boost :: function1&,const boost :: function1&)/ usr / local / include / boost / function / function_base.hpp:872:3:note:template typename boost :: enable_if_c :: value> :: value,bool> :: type boost :: operator!=(boost :: reference_wrapper,const boost :: function_base&)/usr/local/include/boost/function/function_base.hpp:863:3:注意:template typename 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:note:template typename 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:note:template typename 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:note:bool boost :: operator!=(boost :: detail :: function :: useless_clear_type *,const boost :: function_base&)


使用gcc 4.3测试Boost 4.6可以工作。

你看过这个:

http://www.boost.org/doc/libs/1_55_0/doc/html/move/implementing_movable_classes.html#move.implementing_movable_classes.copyable_and_movable_cpp0x

链接地址: http://www.djcxy.com/p/29753.html

上一篇: Compiling boost::move in gcc 4.6.4

下一篇: Compile errors using std::bind in gcc 4.7