|
dune-functions 2.10
|
A double-ended queue (deque) class with statically reserved memory. More...
#include <dune/functions/common/reserveddeque.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< ReservedDeque, value_type > | iterator |
| Iterator used to iterate through a vector. | |
| typedef Dune::GenericIterator< const ReservedDeque, const value_type > | const_iterator |
| Const iterator used to iterate through a vector. | |
Public Member Functions | |
| ReservedDeque (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 | push_front (const T &t) |
| Prepends an element to the begin of a deque if size<capacity, O(1) time. | |
| void | pop_back () |
| Erases the last element of the vector, O(1) time. | |
| void | pop_front () |
| Erases the first 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. | |
Friends | |
| std::ostream & | operator<< (std::ostream &s, const ReservedDeque &v) |
| Send ReservedDeque to an output stream. | |
| 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. | |
A double-ended queue (deque) class with statically reserved memory.
ReservedDeque is something between std::array and std::deque. You have a double ended queue which can be extended and shrunk using methods like push_back and pop_back at the end, or via push_front and pop_front, but reserved memory is predefined.
This implies that the deque cannot grow bigger than the predefined maximum size.
| T | The data type ReservedDeque stores |
| n | The maximum number of objects the ReservedDeque can store |
| typedef Dune::GenericIterator<const ReservedDeque, const value_type> Dune::Functions::ReservedDeque< T, n >::const_iterator |
Const iterator used to iterate through a vector.
| typedef const T& Dune::Functions::ReservedDeque< T, n >::const_reference |
Const reference to T.
| typedef std::ptrdiff_t Dune::Functions::ReservedDeque< T, n >::difference_type |
A signed integral type.
| typedef Dune::GenericIterator<ReservedDeque, value_type> Dune::Functions::ReservedDeque< T, n >::iterator |
Iterator used to iterate through a vector.
| typedef T* Dune::Functions::ReservedDeque< T, n >::pointer |
Pointer to T.
| typedef T& Dune::Functions::ReservedDeque< T, n >::reference |
Reference to T.
| typedef size_t Dune::Functions::ReservedDeque< T, n >::size_type |
An unsigned integral type.
| typedef T Dune::Functions::ReservedDeque< T, n >::value_type |
The type of object, T, stored in the vector.
Typedefs
|
inline |
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 |
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 |
Erases the first 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 |
Prepends an element to the begin of a deque if size<capacity, O(1) time.
|
inline |
Specifies a new size for the vector.
|
inline |
Returns number of elements in the vector.
Informative Methods
|
friend |
Send ReservedDeque to an output stream.