Why does std::bitset expose bits in little-endian fashion?
问题 When I use std::bitset<N>::bitset( unsigned long long ) this constructs a bitset and when I access it via the operator[] , the bits seems to be ordered in the little-endian fashion. Example: std::bitset<4> b(3ULL); std::cout << b[0] << b[1] << b[2] << b[3]; prints 1100 instead of 0011 i.e. the ending (or LSB) is at the little (lower) address, index 0. Looking up the standard, it says initializing the first M bit positions to the corresponding bit values in val Programmers naturally think of