| Parameter | Description | Default |
|---|---|---|
| T | the vector's value_type | |
| Alloc | the vector's allocator [1] | std::allocator<T> |
| S | the vector's size_type | std::allocator<T>::size_type |
| T | Must be a model of Assignable |
| S | Must be implicitly convertible to std::allocator<T>::size_type. The reason is that the size of course need to passed on to the allocator |
| Member | Where defined | Comment | |
|---|---|---|---|
| size_type | VectorExpression | ||
| value_type | VectorExpression | ||
| const_reference | VectorExpression | Defined as value_type const &. | |
| reference | VectorCollection | Defined as value_type&. | |
| dense_vector() | DefaultConstructible | The vector's size after default-construction will be equal to 0. | |
| dense_vector(size_type) | SizeConstructible | ||
| dense_vector(dense_vector const&) | Assignable , Expression | Deep copies the elements | |
| dense_vector& operator=(dense_vector const&) | Assignable | ||
| ~dense_vector() | Expression | ||
| bool operator==(dense_vector const&) const | EqualityComparable | ||
| bool operator!=(dense_vector const&) const | EqualityComparable | ||
| size_type size() const | VectorExpression , SizeConstructible | ||
| void resize(size_type) | SizeConstructible | ||
| const_reference operator[](size_type) const | VectorExpression | ||
| const_reference operator()(size_type) const | VectorExpression | ||
| reference operator[](size_type) | VectorCollection | ||
| reference operator()(size_type) | VectorCollection | ||
| iterator | RandomAccessContainer | Defined as value_type* [2] | |
| const_iterator | RandomAccessContainer | Defined as value_type const * [2] | |
| iterator begin() | RandomAccessContainer | ||
| const_iterator begin() const | RandomAccessContainer | ||
| iterator end() | RandomAccessContainer | ||
| const_iterator end() const | RandomAccessContainer |
| Function | Where defined | Comment |
|---|
[1] The Alloc template argument provides not enough flexibility and room for optimisation. Therefore it will be replaced by a storage type in the future that will allow to easily allocate vector's on heap but also on the stack, in user-defined pools etc. See also the SGI allocators for more background info.
[2] The dense-vector is only a
model of RandomAccessContainer to increase the compatibility with
std::vector becausers generally expect this
compatibility.
[3] The reason for defining iterators as pointers is because compilers are more capable of optimising pointers