似乎std::bitset不附带 STL 迭代器。
因此,我不能执行以下操作:
std::bitset<8> bs;
for (auto it: bs) {
std::cout << "this can not be done out of the box\n";
}
相反,我必须:
std::bitset<8> bs;
for (std::size_t i = 0; i < bs.size(); ++i) {
std::cout << bs[i] << '\n';
}
如果没有迭代器,我也不能将位集与任何 STL 算法一起使用。
为什么委员会决定从 bitset 中排除迭代器?