O'Reilly logo
  • Tzuhao Kuo thinks this is interesting:

Though std::vector<bool> conceptually holds bools, operator[] for std::vector<bool> doesn’t return a reference to an element of the container (which is what std::vector::operator[] returns for every type except bool). Instead, it returns an object of type std::vector<bool>::reference (a class nested inside std::vector<bool>).


Cover of Effective Modern C++


operator[] & std::vector<bool>