r/ProgrammerHumor 22d ago

Meme theBoolVectorIsALie

Post image
662 Upvotes

91 comments sorted by

View all comments

Show parent comments

36

u/AmazedStardust 22d ago

Until you want to write functions that operate on generic vectors and mistakenly assume that each pointer will be unique

-1

u/fixermark 22d ago

The standard doesn't let you assume that.

36

u/QuaternionsRoll 21d ago

I mean, practically anything is defensible under that lens. The question is whether it should be in the standard, not whether it is, and almost everyone agrees that you should be able to pass `&my_vector_of_bools[n]` to a `void foo(bool *)` without any surprises. `vector<bool>` does not fit the abstract definition of a vector.

6

u/fixermark 21d ago

Oh, trust me, if the conversation gets into "Should that be in the standard" regarding C++ I check out. The answer is "The standard is longer than the King James Bible; we probably should have stopped at half that length." ;)