Description
vector is a container type for storing sequences of elements. It offers efficient random access to elements using the [] operator. A vector is less efficient at operations that require insertion or removal of elements from the middle of the sequence.
Declaration
template <class T, class A = allocator<T> > class std::vector;
Concept
The sample program defines a vector, and then pushes a series of elements onto the back of it. This is an efficient operation, requiring only occasional growing of the underlying representation structure. Then the first element's value is overwritten to be 48. We next insert a new element 100 before the element with value 101, and then erase the element with value 201. Finally, size() and iterators are used to dump out the element values, which are:
48 100 101 213
Supported
Supported
Supported