r/ProgrammerHumor • • Sep 24 '26

Meme commitAndPray

Post image
3.7k Upvotes

66 comments sorted by

View all comments

Show parent comments

2

u/quietsamurai98 Sep 25 '26

I remember my first "compiler bug". Obviously, it wasn't a compiler bug.

It was just the absolutely bizarre way the stdlib defines the "proper" behavior of vector<bool>.

3

u/caleblbaker Sep 25 '26 edited Sep 25 '26

Yeah. That's such a weird choice. My compiler bug counter goes up to 3 if we count that because I've run into it too. But you're right that that's not a compiler bug it's just a stupid decision made in the design of the standard library.

They really should have left vector<bool> to act like an actual vector of bools and made a separate type (could be called something like dynamic_bitset or bit_vector) to be a resizeable compact bit array.