Why isn't vector<bool> a STL container?
问题 Item 18 of Scott Meyers's book Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library says to avoid vector <bool> as it's not an STL container and it doesn't really hold bool s. The following code: vector <bool> v; bool *pb =&v[0]; will not compile, violating a requirement of STL containers. Error: cannot convert 'std::vector<bool>::reference* {aka std::_Bit_reference*}' to 'bool*' in initialization vector<T>::operator [] return type is supposed to be T& , but