C++ standard draft n3242 in 23.2, in table containing container requirements, states that X::reference
for container containing T
must be lvalue T
. Yet, for vector<bool>
, vector<bool>::reference
is another class, a proxy for accessing individual bits of bytes stored in vector.
Does that mean that std::vector
class template specification for T = bool
, defined in standard, fails to fulfill container requirements?
Does that mean that
std::vector
class template specification forT = bool
, defined in standard, fails to fulfill container requirements?
Yes.
Similarly, its iterators are not truly random access iterators, because operator*
yields a proxy object.
vector<bool>
is a mess.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With