[libc++] Why doesn't libc++ define std::vector<bool>::const_reference as bool?

Hi. According to the C++ Standard (section [vector.bool]), std::vector::const_reference should be defined as bool. libc++ defines it as std::__1::__bit_const_reference<std::__1::vector<bool, std::__1::allocator>>]. Is this divergence from the standard intentional? If it is, what is the purpose?

Unless I’m mis-reading the spec, vector<bool>::const_reference is implementation defined. Not bool. See [vector.bool].


Unless I'm mis-reading the spec, `vector<bool>::const_reference` is
implementation defined. Not bool. See [vector.bool]

It says:

using const_reference = bool;

Looking again, it seems like a libc++ bug. Not sure if Howard intended to be non-conforming here, but it’s likely a mistake.

Feel free to file a bug.


Actually Howard explains this non-conformance in a self answer Stackoverflow question "Why is libc++'s vector::const_reference not bool?”: