r/ProgrammerHumor • • 12d ago

Meme cppAndItsVectorBooleans

Post image
3.4k Upvotes

214 comments sorted by

View all comments

Show parent comment

1

u/narrill 11d ago

This has absolutely nothing to do with the standard not specifying a concrete size. What is stored in a vector<bool> is not bool, flat out. So its size is irrelevant.

Bitwise bool collections do indeed have legitimate use cases, which is why they should have been included in the standard as their own independent type. Including them as a goofy specialization of vector<bool> causes very real problems with template metaprogramming and thread safety.