|
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. | |
| typedef T * | pointer |
| Pointer to T. | |
| typedef T & | reference |
| Reference to T. | |
| typedef const T & | const_reference |
| Const reference to T. | |
| typedef size_t | size_type |
| An unsigned integral type. | |
| typedef std::ptrdiff_t | difference_type |
| A signed integral type. | |
| typedef Dune::GenericIterator< ReservedVector, value_type > | iterator |
| Iterator used to iterate through a vector. | |
| typedef Dune::GenericIterator< const ReservedVector, const value_type > | const_iterator |
| Const iterator used to iterate through a vector. | |
Public Member Functions | |
| bool | operator== (const ReservedVector &other) const |
| ReservedVector (std::initializer_list< T > const &l) | |
| void | clear () |
| Erases all elements. | |
| void | resize (size_t s) |
| Specifies a new size for the vector. | |
| void | push_back (const T &t) |
| Appends an element to the end of a vector, up to the maximum size n, O(1) time. | |
| void | pop_back () |
| Erases the last element of the vector, O(1) time. | |
| iterator | begin () |
| Returns a iterator pointing to the beginning of the vector. | |
| const_iterator | begin () const |
| Returns a const_iterator pointing to the beginning of the vector. | |
| iterator | end () |
| Returns an iterator pointing to the end of the vector. | |
| const_iterator | end () const |
| Returns a const_iterator pointing to the end of the vector. | |
| reference | operator[] (size_type i) |
| Returns reference to the i'th element. | |
| const_reference | operator[] (size_type i) const |
| Returns a const reference to the i'th element. | |
| reference | front () |
| Returns reference to first element of vector. | |
| const_reference | front () const |
| Returns const reference to first element of vector. | |
| reference | back () |
| Returns reference to last element of vector. | |
| const_reference | back () const |
| Returns const reference to last element of vector. | |
| size_type | size () const |
| Returns number of elements in the vector. | |
| bool | empty () const |
| Returns true if vector has no elements. | |
| static constexpr size_type | capacity () |
| Returns current capacity (allocated memory) of the vector. | |
| static constexpr size_type | max_size () |
| Returns the maximum length of the vector. | |
Detailed Description
class Dune::ReservedVector< T, n >
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.
- Template Parameters
-
T The data type ReservedVector stores. n The maximum number of objects the ReservedVector can store.
Member Typedef Documentation
◆ const_iterator
| typedef Dune::GenericIterator<const ReservedVector, const value_type> Dune::ReservedVector< T, n >::const_iterator |
Const iterator used to iterate through a vector.
◆ const_reference
| typedef const T& Dune::ReservedVector< T, n >::const_reference |
Const reference to T.
◆ difference_type
| typedef std::ptrdiff_t Dune::ReservedVector< T, n >::difference_type |
A signed integral type.
◆ iterator
| typedef Dune::GenericIterator<ReservedVector, value_type> Dune::ReservedVector< T, n >::iterator |
Iterator used to iterate through a vector.
◆ pointer
| typedef T* Dune::ReservedVector< T, n >::pointer |
Pointer to T.
◆ reference
| typedef T& Dune::ReservedVector< T, n >::reference |
Reference to T.
◆ size_type
| typedef size_t Dune::ReservedVector< T, n >::size_type |
An unsigned integral type.
◆ value_type
| typedef T Dune::ReservedVector< T, n >::value_type |
The type of object, T, stored in the vector.
Typedefs
Constructor & Destructor Documentation
◆ ReservedVector() [1/2]
|
default |
Constructor.
Constructors
◆ ReservedVector() [2/2]
|
inline |
Member Function Documentation
◆ back() [1/2]
|
inline |
Returns reference to last element of vector.
◆ back() [2/2]
|
inline |
Returns const reference to last element of vector.
◆ begin() [1/2]
|
inline |
Returns a iterator pointing to the beginning of the vector.
◆ begin() [2/2]
|
inline |
Returns a const_iterator pointing to the beginning of the vector.
◆ capacity()
|
inlinestaticconstexpr |
Returns current capacity (allocated memory) of the vector.
◆ clear()
|
inline |
Erases all elements.
Data access operations
◆ empty()
|
inline |
Returns true if vector has no elements.
◆ end() [1/2]
|
inline |
Returns an iterator pointing to the end of the vector.
◆ end() [2/2]
|
inline |
Returns a const_iterator pointing to the end of the vector.
◆ front() [1/2]
|
inline |
Returns reference to first element of vector.
◆ front() [2/2]
|
inline |
Returns const reference to first element of vector.
◆ max_size()
|
inlinestaticconstexpr |
Returns the maximum length of the vector.
◆ operator==()
|
inline |
◆ operator[]() [1/2]
|
inline |
Returns reference to the i'th element.
◆ operator[]() [2/2]
|
inline |
Returns a const reference to the i'th element.
◆ pop_back()
|
inline |
Erases the last element of the vector, O(1) time.
◆ push_back()
|
inline |
Appends an element to the end of a vector, up to the maximum size n, O(1) time.
◆ resize()
|
inline |
Specifies a new size for the vector.
◆ size()
|
inline |
Returns number of elements in the vector.
Informative Methods
The documentation for this class was generated from the following file:
Legal Statements / Impressum | Hosted by TU Dresden & Uni Heidelberg | Generated by
1.9.8