r/ProgrammerHumor • • 11d ago

Meme cppAndItsVectorBooleans

Post image
3.4k Upvotes

214 comments sorted by

View all comments

Show parent comment

1

u/da_Aresinger 11d ago

I mean, cppreference literally says:

The elements are stored contiguously, which means that elements can be accessed not only through iterators, but also using offsets to regular pointers to elements.

I guess that's not the ISO, but I'm not about to pull that out.

3

u/the_horse_gamer 11d ago

vectors are elements of vector spaces, not a sequence of numbers

std::vector is not a vector

1

u/da_Aresinger 11d ago

ok, I get your drift. You have a point.

3

u/the_horse_gamer 11d ago

Quote from the book "From Mathematics to Generic Programming" by Alexander Stepanov (the creator of the stl) and Daniel Rose:

The name vector in STL was taken from the earlier programming languages Scheme and Common Lisp. Unfortunately, this was inconsistent with the much older meaning of the term in mathematics and violates Rule 3; this data structure should have been called array. Sadly, if you make a mistake and violate these principles, the result might stay around for a long time.