如何从字符串中强制转换Boost::thread::id
How to cast back Boost::thread::id from string?
所以我将boost::lexical_cast<std::string>(boost::this_thread::get_id())
这个线程id转换为string。现在我想知道是否有可能把它变成线程::id?
既然您提到调用->interrupt,我假定您需要boost::thread对象,而不是boost::thread:id对象。
您最好的选择可能是在生成线程时创建string - boost::thread对象的映射
我认为你可以使用'boost::lexical_cast'将字符串转换为int/short/the_type_you_want。它看起来像这样:
boost::lexical_cast<int>(string_of_thread_id);
相关文章:
- 当我尝试使用 sstream 和分面将 Boost Time_duration转换为字符串时,我没有得到所需的格式
- Boost buffer_cast 无法从 void* 转换为 PointerToPodType
- Boost.Spirit将表达转换为AST
- 将 boost 序列化对象的 asio::streambuf 表示转换为 Beast 的 DynamicBody req.body()
- 将"boost::tuple "转换为"boost::fusion::tuple&quo
- 用于 boost::p roperty_tree 的通用枚举转换器
- 如何将 boost::hana::map 转换为 lambda
- 如何将 boost::hana::tuple 转换为 std::变体
- 将 boost::文件系统::p ath 转换为 char?
- Boost.Hana:在 constexpr 上下文中将值元组转换为相应类型的元组
- 为什么要 boost::p roperty_tree::write_json() 将整数值转换为字符串?这是不正确的
- 如何正确地将boost::asio::buffers_iterator转换为InputIterator
- 如何将boost::asio::ip::address_v6 ip转换为2个uint64_t数字,并从2个uint 64
- 如何将 boost::beast 的响应<buffer_body>转换为响应<string_body>?
- 为boost::dynamic_bitset生成哈希,并将哈希转换回boost::dynamic_bitset
- 如何将 time-uuid(存储在 boost uuid 中)转换为时间戳/自纪元以来的时间?
- 将 boost:::chrono::steady_clock::time_point 转换为标准::时间::steady
- n-ary布尔语法从中缀到前缀的Boost::Spirit转换?
- 寻找Boost转换迭代器的复合特征模式
- 使用boost转换度、分、秒、弧度