![]() |
Chemical Data Processing Library C++ API - Version 1.4.0
|
Variable-size vector with a fixed upper capacity N stored in a stack-allocated array. More...
#include <Vector.hpp>
Inheritance diagram for CDPL::Math::BoundedVector< T, N >:Public Types | |
| typedef T | ValueType |
| The scalar value type. More... | |
| typedef T & | Reference |
| Mutable reference type to an element. More... | |
| typedef const T & | ConstReference |
| Constant reference type to an element. More... | |
| typedef std::size_t | SizeType |
| The unsigned size type. More... | |
| typedef std::ptrdiff_t | DifferenceType |
| The signed difference type. More... | |
| typedef ValueType | ArrayType[N] |
| The fixed-capacity C-array type used for in-memory storage. More... | |
| typedef T * | Pointer |
| Pointer type for raw access to the element array. More... | |
| typedef const T * | ConstPointer |
| Constant pointer type for raw access to the element array. More... | |
| typedef VectorReference< SelfType > | ClosureType |
| Closure type used when this vector appears inside another expression. More... | |
| typedef const VectorReference< const SelfType > | ConstClosureType |
| Constant closure type used when this vector appears inside another expression. More... | |
| typedef BoundedVector< T, N+1 > | VectorTemporaryType |
| Concrete temporary vector type used by expression-template machinery (one element larger than the bound). More... | |
| typedef std::shared_ptr< SelfType > | SharedPointer |
A reference-counted smart pointer [SHPTR] for dynamically allocated BoundedVector instances. More... | |
| typedef std::initializer_list< T > | InitializerListType |
| The initializer-list type accepted by constructors and assignment. More... | |
Public Types inherited from CDPL::Math::VectorContainer< BoundedVector< T, N > > | |
| typedef BoundedVector< T, N > | ContainerType |
| The derived vector container type. More... | |
Public Types inherited from CDPL::Math::VectorExpression< E > | |
| typedef E | ExpressionType |
| The derived vector expression type. More... | |
Public Types inherited from CDPL::Math::Expression< E > | |
| typedef E | ExpressionType |
| The derived expression type (made available to expression-template machinery). More... | |
Public Member Functions | |
| BoundedVector () | |
| Constructs an empty bounded vector (size zero, capacity N). More... | |
| BoundedVector (SizeType n) | |
| Constructs a bounded vector of size n with value-initialized elements. More... | |
| BoundedVector (SizeType n, const ValueType &v) | |
| Constructs a bounded vector of size n with every element initialized to v. More... | |
| BoundedVector (const BoundedVector &v) | |
| Constructs a copy of the bounded vector v. More... | |
| BoundedVector (InitializerListType l) | |
| Constructs a bounded vector with the contents of the initializer list l. More... | |
| template<typename E > | |
| BoundedVector (const VectorExpression< E > &e) | |
| Constructs a bounded vector from the vector expression e. More... | |
| Reference | operator[] (SizeType i) |
| Returns a mutable reference to the element at index i (alias for operator()). More... | |
| ConstReference | operator[] (SizeType i) const |
Returns a const reference to the element at index i (alias for operator()). More... | |
| Reference | operator() (SizeType i) |
| Returns a mutable reference to the element at index i. More... | |
| ConstReference | operator() (SizeType i) const |
Returns a const reference to the element at index i. More... | |
| bool | isEmpty () const |
| Tells whether the vector is empty. More... | |
| SizeType | getSize () const |
| Returns the current element count. More... | |
| SizeType | getMaxSize () const |
| Returns the compile-time maximum capacity N. More... | |
| Pointer | getData () |
| Returns a mutable pointer to the contiguous element array. More... | |
| ConstPointer | getData () const |
Returns a const pointer to the contiguous element array. More... | |
| BoundedVector & | operator= (const BoundedVector &v) |
| Copy-assigns the elements of v to this bounded vector. More... | |
| BoundedVector & | operator= (InitializerListType l) |
| Assigns the contents of the initializer list l to this bounded vector. More... | |
| template<typename C > | |
| BoundedVector & | operator= (const VectorContainer< C > &c) |
| Assigns the contents of the vector container c to this bounded vector (no alias check needed). More... | |
| template<typename E > | |
| BoundedVector & | operator= (const VectorExpression< E > &e) |
| Assigns the vector expression e to this bounded vector (via a temporary to handle aliasing). More... | |
| template<typename C > | |
| BoundedVector & | operator+= (const VectorContainer< C > &c) |
| Adds the contents of the vector container c element-wise to this bounded vector (no alias check needed). More... | |
| BoundedVector & | operator+= (InitializerListType l) |
| Adds the contents of the initializer list l element-wise to this bounded vector. More... | |
| template<typename E > | |
| BoundedVector & | operator+= (const VectorExpression< E > &e) |
| Adds the vector expression e element-wise to this bounded vector (via a temporary to handle aliasing). More... | |
| template<typename C > | |
| BoundedVector & | operator-= (const VectorContainer< C > &c) |
| Subtracts the contents of the vector container c element-wise from this bounded vector (no alias check needed). More... | |
| BoundedVector & | operator-= (InitializerListType l) |
| Subtracts the contents of the initializer list l element-wise from this bounded vector. More... | |
| template<typename E > | |
| BoundedVector & | operator-= (const VectorExpression< E > &e) |
| Subtracts the vector expression e element-wise from this bounded vector (via a temporary to handle aliasing). More... | |
| template<typename T1 > | |
| std::enable_if< IsScalar< T1 >::value, BoundedVector >::type & | operator*= (const T1 &t) |
| Multiplies every element by the scalar t. More... | |
| template<typename T1 > | |
| std::enable_if< IsScalar< T1 >::value, BoundedVector >::type & | operator/= (const T1 &t) |
| Divides every element by the scalar t. More... | |
| template<typename E > | |
| BoundedVector & | assign (const VectorExpression< E > &e) |
| Resizes this vector to match e and assigns the elements of e without intermediate temporary. More... | |
| BoundedVector & | assign (InitializerListType l) |
| Resizes this vector to match l and copies the elements of l in. More... | |
| template<typename E > | |
| BoundedVector & | plusAssign (const VectorExpression< E > &e) |
| Adds the elements of the vector expression e to this vector without intermediate temporary. More... | |
| BoundedVector & | plusAssign (InitializerListType l) |
| Adds the contents of the initializer list l element-wise to this vector without intermediate temporary. More... | |
| template<typename E > | |
| BoundedVector & | minusAssign (const VectorExpression< E > &e) |
| Subtracts the elements of the vector expression e from this vector without intermediate temporary. More... | |
| BoundedVector & | minusAssign (InitializerListType l) |
| Subtracts the contents of the initializer list l element-wise from this vector without intermediate temporary. More... | |
| void | swap (BoundedVector &v) |
| Swaps the contents of this bounded vector with those of v. More... | |
| void | clear (const ValueType &v=ValueType()) |
| Sets every element of the vector to the value v (size is unchanged). More... | |
| void | resize (SizeType n) |
| Resizes the vector to n elements (new elements are left value-uninitialized). More... | |
| void | resize (SizeType n, const ValueType &v) |
| Resizes the vector to n elements; newly added elements are set to v. More... | |
Public Member Functions inherited from CDPL::Math::VectorContainer< BoundedVector< T, N > > | |
| const ContainerType & | operator() () const |
Returns a const reference to the derived vector container. More... | |
| ContainerType & | operator() () |
| Returns a reference to the derived vector container. More... | |
Public Member Functions inherited from CDPL::Math::VectorExpression< E > | |
| const ExpressionType & | operator() () const |
Returns a const reference to the derived vector expression. More... | |
| ExpressionType & | operator() () |
| Returns a reference to the derived vector expression. More... | |
Static Public Attributes | |
| static const SizeType | MaxSize = N |
| The compile-time maximum capacity N. More... | |
Friends | |
| void | swap (BoundedVector &v1, BoundedVector &v2) |
| ADL-enabled free-function form of swap(). More... | |
Additional Inherited Members | |
Protected Member Functions inherited from CDPL::Math::VectorContainer< BoundedVector< T, N > > | |
| VectorContainer () | |
| ~VectorContainer () | |
Protected Member Functions inherited from CDPL::Math::VectorExpression< E > | |
| VectorExpression () | |
| ~VectorExpression () | |
Protected Member Functions inherited from CDPL::Math::Expression< E > | |
| Expression () | |
| ~Expression () | |
Variable-size vector with a fixed upper capacity N stored in a stack-allocated array.
| T | The scalar value type. |
| N | The maximum vector size. |
| typedef T CDPL::Math::BoundedVector< T, N >::ValueType |
The scalar value type.
| typedef T& CDPL::Math::BoundedVector< T, N >::Reference |
Mutable reference type to an element.
| typedef const T& CDPL::Math::BoundedVector< T, N >::ConstReference |
Constant reference type to an element.
| typedef std::size_t CDPL::Math::BoundedVector< T, N >::SizeType |
The unsigned size type.
| typedef std::ptrdiff_t CDPL::Math::BoundedVector< T, N >::DifferenceType |
The signed difference type.
| typedef ValueType CDPL::Math::BoundedVector< T, N >::ArrayType[N] |
The fixed-capacity C-array type used for in-memory storage.
| typedef T* CDPL::Math::BoundedVector< T, N >::Pointer |
Pointer type for raw access to the element array.
| typedef const T* CDPL::Math::BoundedVector< T, N >::ConstPointer |
Constant pointer type for raw access to the element array.
| typedef VectorReference<SelfType> CDPL::Math::BoundedVector< T, N >::ClosureType |
Closure type used when this vector appears inside another expression.
| typedef const VectorReference<const SelfType> CDPL::Math::BoundedVector< T, N >::ConstClosureType |
Constant closure type used when this vector appears inside another expression.
| typedef BoundedVector<T, N + 1> CDPL::Math::BoundedVector< T, N >::VectorTemporaryType |
Concrete temporary vector type used by expression-template machinery (one element larger than the bound).
| typedef std::shared_ptr<SelfType> CDPL::Math::BoundedVector< T, N >::SharedPointer |
A reference-counted smart pointer [SHPTR] for dynamically allocated BoundedVector instances.
| typedef std::initializer_list<T> CDPL::Math::BoundedVector< T, N >::InitializerListType |
The initializer-list type accepted by constructors and assignment.
|
inline |
Constructs an empty bounded vector (size zero, capacity N).
|
inlineexplicit |
Constructs a bounded vector of size n with value-initialized elements.
| n | The initial element count. |
| Base::SizeError | if n exceeds the bound N. |
|
inline |
Constructs a bounded vector of size n with every element initialized to v.
| n | The initial element count. |
| v | The initial element value. |
| Base::SizeError | if n exceeds the bound N. |
|
inline |
Constructs a copy of the bounded vector v.
| v | The bounded vector to copy. |
|
inline |
Constructs a bounded vector with the contents of the initializer list l.
| l | The initializer list providing the initial elements. |
| Base::SizeError | if l.size() exceeds the bound N. |
|
inline |
Constructs a bounded vector from the vector expression e.
| E | The source vector expression type. |
| e | The source vector expression. |
| Base::SizeError | if the size of e exceeds the bound N. |
|
inline |
Returns a mutable reference to the element at index i (alias for operator()).
| i | The zero-based element index. |
| Base::IndexError | if i is out of range. |
|
inline |
Returns a const reference to the element at index i (alias for operator()).
| i | The zero-based element index. |
const reference to the element. | Base::IndexError | if i is out of range. |
|
inline |
Returns a mutable reference to the element at index i.
| i | The zero-based element index. |
| Base::IndexError | if i is out of range. |
|
inline |
Returns a const reference to the element at index i.
| i | The zero-based element index. |
const reference to the element. | Base::IndexError | if i is out of range. |
|
inline |
Tells whether the vector is empty.
true if the vector contains no elements, and false otherwise.
|
inline |
Returns the current element count.
|
inline |
Returns the compile-time maximum capacity N.
|
inline |
Returns a mutable pointer to the contiguous element array.
|
inline |
Returns a const pointer to the contiguous element array.
const pointer to the element array.
|
inline |
Copy-assigns the elements of v to this bounded vector.
| v | The source bounded vector. |
|
inline |
Assigns the contents of the initializer list l to this bounded vector.
| l | The initializer list providing the new elements. |
| Base::SizeError | if l.size() exceeds the bound N. |
|
inline |
Assigns the contents of the vector container c to this bounded vector (no alias check needed).
| C | The source vector container type. |
| c | The source vector container. |
|
inline |
Assigns the vector expression e to this bounded vector (via a temporary to handle aliasing).
| E | The source vector expression type. |
| e | The source vector expression. |
|
inline |
Adds the contents of the vector container c element-wise to this bounded vector (no alias check needed).
| C | The source vector container type. |
| c | The source vector container. |
|
inline |
Adds the contents of the initializer list l element-wise to this bounded vector.
| l | The initializer list providing the addends. |
|
inline |
Adds the vector expression e element-wise to this bounded vector (via a temporary to handle aliasing).
| E | The source vector expression type. |
| e | The source vector expression. |
|
inline |
Subtracts the contents of the vector container c element-wise from this bounded vector (no alias check needed).
| C | The source vector container type. |
| c | The source vector container. |
|
inline |
Subtracts the contents of the initializer list l element-wise from this bounded vector.
| l | The initializer list providing the subtrahends. |
|
inline |
Subtracts the vector expression e element-wise from this bounded vector (via a temporary to handle aliasing).
| E | The source vector expression type. |
| e | The source vector expression. |
|
inline |
Multiplies every element by the scalar t.
| T1 | The scalar type. |
| t | The scalar multiplier. |
|
inline |
Divides every element by the scalar t.
| T1 | The scalar type. |
| t | The scalar divisor. |
|
inline |
Resizes this vector to match e and assigns the elements of e without intermediate temporary.
| E | The source vector expression type. |
| e | The source vector expression. |
| Base::SizeError | if the size of e exceeds the bound N. |
|
inline |
Resizes this vector to match l and copies the elements of l in.
| l | The initializer list providing the new elements. |
| Base::SizeError | if l.size() exceeds the bound N. |
|
inline |
Adds the elements of the vector expression e to this vector without intermediate temporary.
| E | The source vector expression type. |
| e | The source vector expression. |
|
inline |
Adds the contents of the initializer list l element-wise to this vector without intermediate temporary.
| l | The initializer list providing the addends. |
|
inline |
Subtracts the elements of the vector expression e from this vector without intermediate temporary.
| E | The source vector expression type. |
| e | The source vector expression. |
|
inline |
Subtracts the contents of the initializer list l element-wise from this vector without intermediate temporary.
| l | The initializer list providing the subtrahends. |
|
inline |
Swaps the contents of this bounded vector with those of v.
| v | The bounded vector to swap with. |
|
inline |
Sets every element of the vector to the value v (size is unchanged).
| v | The fill value. |
|
inline |
Resizes the vector to n elements (new elements are left value-uninitialized).
| n | The new element count. |
| Base::SizeError | if n exceeds the bound N. |
|
inline |
Resizes the vector to n elements; newly added elements are set to v.
| n | The new element count. |
| v | The fill value for newly added elements. |
| Base::SizeError | if n exceeds the bound N. |
|
friend |
ADL-enabled free-function form of swap().
| v1 | The first bounded vector. |
| v2 | The second bounded vector. |
|
static |
The compile-time maximum capacity N.