15.5.1. vector Sequence Container
vector, which we introduced in Section 7.10, provides a data structure with contiguous memory locations. This enables efficient, direct access to any element of a
vector via the subscript operator
, exactly as with a built-in array. Like class template
vector is most commonly used when the data in the container must be easily accessible via a subscript or will be sorted, and when the number of elements may need to grow. When a
vector’s memory is exhausted, the
vector allocates a larger built-in array, copies (or moves; Chapter 24) the original elements into the new built-in array ...