I saw the following posted by one of the fellow stackoverflower and it sort of dumbfounds me.
Would someone explain the shifting operations in the following code snippet:
std::vector<bool> a;
a.push_back(true);
a.push_back(false);
//...
for (auto it = a.begin(); it != a.end();) // see 0x for meaning of auto
{
unsigned b = 0;
for (int i = 0; i < 8*sizeof(b); ++i)
{
b |= (*it & 1) << (8*sizeof(b) - 1 - i);
++it;
}
// flush 'b'
}