dense_vector< T, Alloc, S>

Description

A basic dense-vector. This vector is very much like the std::vector<T,Alloc>. This dense-vector though is optimised for performance (instead of convenience). For instance, size-constructing the vector will not default-construct every element in the vector seperatly.

Example

Definition

Defined in dense_vector.hpp.

Template parameters

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

Model of

DenseVector and RandomAccessContainer [3]

Type requirements

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

Public base classes

Members

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

Free functions

Function Where defined Comment

Notes

[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