1
votes

I have a function that uses Boost::move to move a lock -

/**
 * 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;
 }

I could get this code to compile using gcc 4.7.3 with -std=c++11 or -std=c++0x flag. However, with gcc 4.6.4 this code fails even with -std=c++0x flag. Any ideas on how to fix this?

CMAKE flag used to use C++11 functionality:

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

CMAKE flag used to use C++0x functionality:

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

Errors I get with gcc 4.6.4:

error: no match for ‘operator!=’ in ‘iter != ((indexing::skarf::SkarfDatabase*)this)->indexing::skarf::SkarfDatabase::bucketFinderIndex.indexing::skarf::BucketIDT::Finder

::end with P = features::Descriptor, T = long unsigned int’ /home/rahulg/ripe/src/index/skarf/SkarfDatabase.hpp:141:40: note: candidates are: /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: note: no known conversion for argument 1 from ‘indexing::skarf::BucketIDT::iterator’ to ‘const 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/function_template.hpp:1031:8: note: template void boost::operator!=(const boost::function8&, const boost::function8&) /usr/local/include/boost/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: note: template void boost::operator!=(const boost::function6&, const boost::function6&) /usr/local/include/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: template 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: note: 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&)

1
G++ 4.6's support for C++11 features wasn't nearly as far along as 4.7 or 4.8's. See gcc.gnu.org/gcc-4.6/cxx0x_status.html .Joe Z

1 Answers