我有一个使用 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.indexing:: 中的 'operator!=' 不匹配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: 注意:没有已知的参数 1 的转换来自“索引” ::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, bool>::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&)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&)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&)