所以,文档说这个:
template <typename Char, typename Traits, typename Block, typename Alloc>
basic_ostream<Char, Traits>&
operator<<(basic_ostream<Char, Traits>& os, const dynamic_bitset<Block, Alloc>& b)
Run Code Online (Sandbox Code Playgroud)
效果:将b的文本表示插入到流os中(最高位为第一位).非正式地,输出与执行相同
std::basic_string<Char, Traits> s;
boost::to_string(x, s):
os << s;
Run Code Online (Sandbox Code Playgroud)
我根本不明白.
这就是我所拥有的
boost::dynamic_bitset<> bit_value(Config::HASH_WIDTH_IN_BITS, hash_value);
string buffer = bit_value.to_string();
Run Code Online (Sandbox Code Playgroud)
哪个不起作用,导致动态bitset没有成员.to_string();
to_string是boost命名空间中的自由函数,而不是成员函数.
boost::dynamic_bitset<> bit_value(Config::HASH_WIDTH_IN_BITS, hash_value);
string buffer;
to_string(bit_value, buffer);
// here buffer contains the string representation of bit_value.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3089 次 |
| 最近记录: |