当我试图编译一个简单的boost应用程序时
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>在和2010中,我得到了这个错误消息。
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,但是仍然有相同的错误。
发布于 2010-10-21 14:40:06
您可以围绕这一点工作,如这里所示。它看起来像是Boost或编译器在处理rvalue引用时的一个限制。
#define BOOST_NO_RVALUE_REFERENCES成功了。谢谢。
https://stackoverflow.com/questions/3987493
复制相似问题