Vectors contain contiguous elements stored as an array. Accessing members of a vector
or appending elements can be done in constant time, whereas
locating a specific value or inserting elements into the vector takes
linear time.
Constructors |
methods to create vectors |
Operators |
assign and compare vectors |
assign() |
assign elements to the vector |
at() |
returns an element at a specific location |
back() |
returns the last element |
begin() |
returns an iterator to the first element |
capacity() |
the number of elements the vector can hold |
clear() |
removes all elements |
empty() |
true if the vector is empty |
end() |
returns an iterator to the last element |
erase() |
removes elements |
front() |
returns the first element |
get_allocator() |
returns the vector's allocator |
insert() |
insert elements into the vector |
max_size() |
returns the maximum number of elements that the vector can hold |
pop_back() |
removes the last element |
push_back() |
adds an element to the end of the vector |
rbegin() |
returns a reverse iterator to the end of the vector |
rend() |
returns a reverse iterator to the beginning of the vector |
reserve() |
sets the minimum capacity of the vector |
resize() |
change the size of the vector |
size() |
returns the size of the vector |
swap() |
exchange two vectors |