2010-10-21 127 views
2

当我尝试在编译与无法从 '升压::进程间:: mapped_region' 到 '的boost ::进程间:: mapped_region &&' 转换

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

头一个简单的升压应用2010 VS,我收到这个错误信息。

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 ========== 

我不明白是什么问题。我删除了所有的功能实现,只有c_tor和d_tor但仍然是相同的错误..

回答

2

您可以解决此问题,如here所示。在处理rvalue引用时,它看起来像Boost或编译器中的限制。

#define BOOST_NO_RVALUE_REFERENCES 工作。谢谢。