首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不能从“boost::interprocess::mapped_region”转换为“boost::interprocess::mapped_region&”

不能从“boost::interprocess::mapped_region”转换为“boost::interprocess::mapped_region&”
EN

Stack Overflow用户
提问于 2010-10-21 12:35:56
回答 1查看 860关注 0票数 2

当我试图编译一个简单的boost应用程序时

代码语言:javascript
复制
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>

和2010中,我得到了这个错误消息。

代码语言:javascript
复制
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,但是仍然有相同的错误。

EN

回答 1

Stack Overflow用户

发布于 2010-10-21 14:40:06

您可以围绕这一点工作,如这里所示。它看起来像是Boost或编译器在处理rvalue引用时的一个限制。

#define BOOST_NO_RVALUE_REFERENCES成功了。谢谢。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3987493

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档