views:

17

answers:

1

When I try to compile a simple boost application with

#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>

headers in VS 2010, I get the this error message.

c:\program files\boost\boost_1_44_0\boost\interprocess\detail\move.hpp(342): error C2440: 'return' : cannot convert from 'boost::interprocess::mapped_region' to 'boost::interprocess::mapped_region &&'
1>          You cannot bind an lvalue to an rvalue reference
1>          c:\program files\boost\boost_1_44_0\boost\interprocess\mapped_region.hpp(159) : see reference to function template instantiation 'boost::interprocess::mapped_region &&boost::interprocess::move<boost::interprocess::mapped_region&>(T)' being compiled
1>          with
1>          [
1>              T=boost::interprocess::mapped_region &
1>          ]
1>c:\program files\boost\boost_1_44_0\boost\interprocess\detail\move.hpp(342): error C2440: 'return' : cannot convert from 'boost::interprocess::shared_memory_object' to 'boost::interprocess::shared_memory_object &&'
1>          You cannot bind an lvalue to an rvalue reference
1>          c:\program files\boost\boost_1_44_0\boost\interprocess\shared_memory_object.hpp(85) : see reference to function template instantiation 'boost::interprocess::shared_memory_object &&boost::interprocess::move<boost::interprocess::shared_memory_object&>(T)' being compiled
1>          with
1>          [
1>              T=boost::interprocess::shared_memory_object &
1>          ]
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I couldn't understand what the problem. I deleted all the function implementations, there are only c_tor and d_tor but still the same error..

A: 

You can work around this as shown here. It looks like a limitation in either Boost or the compiler in handling rvalue references.

#define BOOST_NO_RVALUE_REFERENCES worked. Thanks.

Steve Townsend