Why is a C++ Vector called a Vector?
Solution 1:
It's called a vector because Alex Stepanov, the designer of the Standard Template Library, was looking for a name to distinguish it from built-in arrays. He admits now that he made a mistake, because mathematics already uses the term 'vector' for a fixed-length sequence of numbers. C++11 compounds this mistake by introducing a class 'array' that behaves similarly to a mathematical vector.
Alex's lesson: be very careful every time you name something.
Solution 2:
Mathematical definition of a vector is a member of the set S
n
, which is an ordered sequence of values in a specific set (S
). This is what a C++ vector
stores.