std::vector
suggest changeIntroduction
A vector is a dynamic array with automatically handled storage. The elements in a vector can be accessed just as efficiently as those in an array with the advantage being that vectors can dynamically change in size.
In terms of storage, a vector's element buffer is (usually) dynamically allocated, and the vector object stores a pointer, a size, and a capacity. A C array or std::array stores its elements inside the object and does not allocate a separate buffer. Those elements have the storage duration of the object that contains them, which is not always automatic storage duration.
Remarks
Use of an std::vector requires the inclusion of the <vector> header using #include <vector>.
Elements in a std::vector are stored contiguously. With the default allocator, that buffer is on the free store when the vector has allocated one. It should be noted that when vectors are nested as in std::vector<std::vector<int> >, the elements of each vector are contiguous, but each vector allocates its own underlying buffer on the free store.