0
我转我的提升版本,我试图重新编译我的代码,但我得到了以下错误:不同升压版本引起的升压/核心/ ref.hpp衰竭删除功能
/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));
任何人都知道我能做些什么来解决这个问题,我正在使用新的提升?
但是,在这种情况下,临时字符串的生命周期是否与绑定返回的对象的生命周期不相同?即不都活着“直到分号”?我可以理解删除'cref(const T &&)'作为防止'auto b = bind(&SomeMethod,cref(MakeTemporary()));'的方法''但在这种情况下,我认为它实际上是安全的。 –
cref不知道。返回字符*是一个临时的,并提高防止创建一个cref。但是,变量本身是静态的,并且不会被修改,因此,只要程序存在,缓冲区char *指向的内容就会保证生效。 – SergeyA