1 Vector
1.1 Description
The templated class vector<T, A>
is the basecontainer adaptor for dense vectors. For an-dimensionalvector and 0 <= i < n every elementvi is mapped to thei-thelement of the container.
1.2 Example
#include <boost/numeric/ublas/vector.hpp> //生成一般的向量,其内置类型的值为0,在默认的情况下 #include <boost/numeric/ublas/io.hpp> int main () { using namespace boost::numeric::ublas; vector<double> v (3); for (unsigned i = 0; i < v.size (); ++ i) v (i) = i; std::cout << v << std::endl; }
1.3 Definition
Defined in the header vector.hpp.
1.4 Template parameters
Parameter | Description | Default |
---|---|---|
T |
The type of object stored in the vector. | |
A |
The type of the Storage array. [1] | unbounded_array<T> |
1.5 Model of
1.6 Type requirements
None, except for those imposed by the requirements of Vectorand RandomAccessContainer.
1.7 Public base classes
vector_container<vector<T, A> >
1.8 Members
Member | Where defined | Description |
---|---|---|
value_type |
VectorExpression | |
reference |
VectorExpression | |
const_reference |
VectorExpression | |
size_type |
VectorExpression | |
difference_type |
VectorExpression | |
const_iterator |
VectorExpression | |
iterator |
VectorExpression | |
const_reverse_iterator |
VectorExpression | |
reverse_iterator |
VectorExpression | |
array_type |
Vector | |
vector () |
VectorExpression | Allocates an uninitialized vector that holds zeroelements. |
vector (size_type size) |
Vector | Allocates an uninitialized vector that holdssize elements. |
vector (const vector &v) |
The copy constructor. | |
template<class AE> |
The extended copy constructor. | |
void resize (size_type size, bool preserve =true) |
Vector | R |