dune-common
2.8.0
|
A Vector class with statically reserved memory. More...
#include <dune/common/reservedvector.hh>
Public Types | |
typedef T | value_type |
The type of object, T, stored in the vector. More... | |
typedef T * | pointer |
Pointer to T. More... | |
typedef T & | reference |
Reference to T. More... | |
typedef const T & | const_reference |
Const reference to T. More... | |
typedef size_t | size_type |
An unsigned integral type. More... | |
typedef std::ptrdiff_t | difference_type |
A signed integral type. More... | |
typedef Dune::GenericIterator< ReservedVector, value_type > | iterator |
Iterator used to iterate through a vector. More... | |
typedef Dune::GenericIterator< const ReservedVector, const value_type > | const_iterator |
Const iterator used to iterate through a vector. More... | |
Public Member Functions | |
bool | operator== (const ReservedVector &other) const |
ReservedVector ()=default | |
Constructor. More... | |
ReservedVector (std::initializer_list< T > const &l) | |
void | clear () |
Erases all elements. More... | |
void | resize (size_t s) |
Specifies a new size for the vector. More... | |
void | push_back (const T &t) |
Appends an element to the end of a vector, up to the maximum size n, O(1) time. More... | |
void | pop_back () |
Erases the last element of the vector, O(1) time. More... | |
iterator | begin () |
Returns a iterator pointing to the beginning of the vector. More... | |
const_iterator | begin () const |
Returns a const_iterator pointing to the beginning of the vector. More... | |
iterator | end () |
Returns an iterator pointing to the end of the vector. More... | |
const_iterator | end () const |
Returns a const_iterator pointing to the end of the vector. More... | |
reference | operator[] (size_type i) |
Returns reference to the i'th element. More... | |
const_reference | operator[] (size_type i) const |
Returns a const reference to the i'th element. More... | |
reference | front () |
Returns reference to first element of vector. More... | |
const_reference | front () const |
Returns const reference to first element of vector. More... | |
reference | back () |
Returns reference to last element of vector. More... | |
const_reference | back () const |
Returns const reference to last element of vector. More... | |
size_type | size () const |
Returns number of elements in the vector. More... | |
bool | empty () const |
Returns true if vector has no elements. More... | |
static constexpr size_type | capacity () |
Returns current capacity (allocated memory) of the vector. More... | |
static constexpr size_type | max_size () |
Returns the maximum length of the vector. More... | |
A Vector class with statically reserved memory.
ReservedVector is something between std::array and std::vector. It is a dynamically sized vector which can be extended and shrunk using methods like push_back and pop_back, but reserved memory is statically predefined.
This implies that the vector cannot grow bigger than the predefined maximum size.
T | The data type ReservedVector stores. |
n | The maximum number of objects the ReservedVector can store. |
typedef Dune::GenericIterator<const ReservedVector, const value_type> Dune::ReservedVector< T, n >::const_iterator |
Const iterator used to iterate through a vector.
typedef const T& Dune::ReservedVector< T, n >::const_reference |
Const reference to T.
typedef std::ptrdiff_t Dune::ReservedVector< T, n >::difference_type |
A signed integral type.
typedef Dune::GenericIterator<ReservedVector, value_type> Dune::ReservedVector< T, n >::iterator |
Iterator used to iterate through a vector.
typedef T* Dune::ReservedVector< T, n >::pointer |
Pointer to T.
typedef T& Dune::ReservedVector< T, n >::reference |
Reference to T.
typedef size_t Dune::ReservedVector< T, n >::size_type |
An unsigned integral type.
typedef T Dune::ReservedVector< T, n >::value_type |
The type of object, T, stored in the vector.
Typedefs
|
default |
Constructor.
Constructors
|
inline |
|
inline |
Returns reference to last element of vector.
|
inline |
Returns const reference to last element of vector.
|
inline |
Returns a iterator pointing to the beginning of the vector.
|
inline |
Returns a const_iterator pointing to the beginning of the vector.
|
inlinestaticconstexpr |
Returns current capacity (allocated memory) of the vector.
|
inline |
Erases all elements.
Data access operations
|
inline |
Returns true if vector has no elements.
|
inline |
Returns an iterator pointing to the end of the vector.
|
inline |
Returns a const_iterator pointing to the end of the vector.
|
inline |
Returns reference to first element of vector.
|
inline |
Returns const reference to first element of vector.
|
inlinestaticconstexpr |
Returns the maximum length of the vector.
|
inline |
|
inline |
Returns reference to the i'th element.
|
inline |
Returns a const reference to the i'th element.
|
inline |
Erases the last element of the vector, O(1) time.
|
inline |
Appends an element to the end of a vector, up to the maximum size n, O(1) time.
|
inline |
Specifies a new size for the vector.
|
inline |
Returns number of elements in the vector.
Informative Methods