...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Front Page / Sequences / Classes / vector |
vector is a variadic, random access, extensible sequence of types that supports constant-time insertion and removal of elements at both ends, and linear-time insertion and removal of elements in the middle. On compilers that support the typeof extension, vector is the simplest and in many cases the most efficient sequence.
Sequence form | Header |
---|---|
Variadic | #include <boost/mpl/vector.hpp> |
Numbered | #include |
In the following table, v is an instance of vector, pos and last are iterators into v, r is a Forward Sequence, n is an Integral Constant, and x and t1,t2,... tn are arbitrary types.
Expression | Semantics |
---|---|
vector<t1,t2,... tn> vectorn<t1,t2,... tn> |
vector of elements t1,t2,... tn; see Variadic Sequence. |
vector<t1,t2,... tn>::type vectorn<t1,t2,... tn>::type |
Identical to vectorn<t1,t2,... tn>; see Variadic Sequence. |
begin |
An iterator pointing to the beginning of v; see Random Access Sequence. |
end |
An iterator pointing to the end of v; see Random Access Sequence. |
size |
The size of v; see Random Access Sequence. |
empty |
A boolean Integral Constant c such that c::value == true if and only if the sequence is empty; see Random Access Sequence. |
front |
The first element in v; see Random Access Sequence. |
back |
The last element in v; see Random Access Sequence. |
at |
The nth element from the beginning of v; see Random Access Sequence. |
insert |
A new vector of following elements:
[begin |
insert_range |
A new vector of following elements:
[begin |
erase |
A new vector of following elements:
[begin |
erase |
A new vector of following elements:
[begin |
clear |
An empty vector; see Extensible Sequence. |
push_back |
A new vector of following elements:
[begin |
pop_back |
A new vector of following elements:
[begin |
push_front |
A new vector of following elements:
x, [begin |
pop_front |
A new vector of following elements:
[next< begin |
typedef vectorfloats; typedef push_back ::type types; BOOST_MPL_ASSERT(( is_same< at_c ::type, int > ));