std::string charBuff = "11010";
dbitset = boost::dynamic_bitset<unsigned char> (charBuff);
for (boost::dynamic_bitset<>::size_type i = 0; i < dbitset.size(); ++i) {
std::cout << dbitset[i];
}
It prints from the LSB to MSB. Output: 01011.
What should I do to so that bitset is printed correctly. I can reverse the character buffer which I am aware of :)
Should be:
What is
buffer? Shouldn't you usecharBuff?Use the
operator<<overload fordynamic_bitsets to achieve what you want. Here's a simplified solution: