I look up the boost's implementation of the dynamic_bitset
and find that they compares the underlying integer storage type to improve the operator<
performance, I test the correctness with following code and get the inconsistent result. Is this a bug?
std::vector<bool> v1, v2;
v1.push_back(0); v1.push_back(1);
v2.push_back(1); v2.push_back(0);
std::cout << (v1 < v2) << '\n';
boost::dynamic_bitset<> b1, b2;
b1.push_back(0); b1.push_back(1);
b2.push_back(1); b2.push_back(0);
std::cout << (b1 < b2) << '\n';
I expect the output of both to be 1
, but the second output is 0
.