r/ProgrammerHumor • • 11d ago

Meme cppAndItsVectorBooleans

Post image
3.4k Upvotes

214 comments sorted by

View all comments

Show parent comment

9

u/Drugbird 10d ago

and if you want byte-aligned behaviour why not just use a vector<uint8_t> and bitshift/mask

Because we have a type system, and I don't want to have to abuse it just to get under some quirky behavior.

also it’s the dynamically allocated version of a std::bitset

Having a std::dynamic_bitset would be great. See e.g. the boost implementation.

Calling it a std::vector is the problem. It's too different from other std:: vectors, which is evident in that it has this huge exception status.

so I think this actually makes sense as long as you know the quirks before making assumption…

This is true for nearly every bad design in programming languages.

1

u/SirPriseTheEigth 10d ago

Well knowing the quirks is what keeps us in a job…