由于删除了函数,不同的boost版本导致boost/core/ref.hpp失败
Different boost version causing failure in boost/core/ref.hpp due to deleted function
我已经切换了我的boost版本,我试图重新编译我的代码,但我得到以下错误:
/boost/core/ref.hpp:179: error: deleted function ' void boost::cref(const T&&) [with T = const char*] '
用于这里的特定行:
// find file prefix with matching system type in systemtype attribute
pugi::xml_named_node_iterator xmniFilePrefix = std::find_if(xmnrFilePrefixes.begin(),xmnrFilePrefixes.end(),
boost::bind(std::equal_to<std::string>(),
boost::bind(PUMLinux::Functions::ObtainAttributeValue, _1, boost::cref(PUMLinux::Configuration::SYSTEMTYPE.c_str())),
c_strSystemType));
有人知道我能做些什么来解决我正在使用的新boost的问题吗?
您不能这样做,boost这样做是完全正确的。您正在将cref()带到临时对象,但cref只不过是对指针的一个花哨的包装。
所以你试图获得c_str()返回的临时对象的地址,这是不允许的。
然而,由于它似乎是静态的,未改变的字符串SYSTEMTYPE,您可以通过完全消除boost::cref
-直接传递c_str()
的返回值来摆脱。您可能需要更改ObtainAttributeValue
的签名以接收指针
相关文章:
- FindPackageHandleStandardArgs.cmake:137 的 CMake 错误(消息):找不到 Boost (缺少:正则表达式)(找到合适的版本"1.72.0",
- yum :在 CentOS 上使用 Boost 1.69 而不是默认 (1.53) 版本
- C++,自使用boost和std::chrono的纪元以来的时间?为什么 Boost 版本慢 10 倍?
- 如何创建一个版本的 boost::range::transform,该版本具有用于捕获上下文的额外参数
- BOOST :: MUTEX版本与调试构建
- 切换到更高的 Boost 版本 1.6.1 时出现编译错误
- CMake错误:导入的目标不适用于Boost版本106300
- 如何根据Boost版本有选择性地包括Boost标头
- 如何使用Boost Ptree来解析像中国人这样的宽字节字符串?Boost版本是Boost_1_64_0
- 外部库Boost版本问题
- 在安装了两个不同 Boost 版本的系统上编译C++代码
- 我应该将哪个 Boost 版本与支持 C++03 的编译器一起使用
- 不能在非 Boost 版本的 Asio 中使用 asio::p laceholders::error
- 更新依赖于 Boost 库的库的 Boost 版本,而无需重新链接
- boost 版本 1.54 boost::filesystem::d irectory_iterator, 尝试使用is
- 如何在 RHEL 上为新的 Boost 版本构建/部署 RPM
- Ubuntu trust上的Boost版本至少为1.56
- 由于删除了函数,不同的boost版本导致boost/core/ref.hpp失败
- Static_cast_tag()在最新boost版本中的替代品
- 使用boost编译以使用可用的boost版本