|
dune-common 2.11
|
A dynamically growing random access list. More...
#include <dune/common/arraylist.hh>

Public Types | |
| typedef T | MemberType |
| The member type that is stored. | |
| typedef T | value_type |
| Value type for stl compliance. | |
| typedef T & | reference |
| The type of a reference to the type we store. | |
| typedef const T & | const_reference |
| The type of a const reference to the type we store. | |
| typedef T * | pointer |
| The type of a pointer to the type we store. | |
| typedef const T * | const_pointer |
| The type of a const pointer to the type we store. | |
| typedef ArrayListIterator< MemberType, N, A > | iterator |
| A random access iterator. | |
| typedef ConstArrayListIterator< MemberType, N, A > | const_iterator |
| A constant random access iterator. | |
| typedef std::size_t | size_type |
| The size type. | |
| typedef std::ptrdiff_t | difference_type |
| The difference type. | |
Public Member Functions | |
| iterator | begin () |
| Get an iterator that is positioned at the first element. | |
| const_iterator | begin () const |
| Get a random access iterator that is positioned at the first element. | |
| iterator | end () |
| Get a random access iterator positioned after the last element. | |
| const_iterator | end () const |
| Get a random access iterator positioned after the last element. | |
| void | push_back (const_reference entry) |
| Append an entry to the list. | |
| reference | operator[] (size_type i) |
| Get the element at specific position. | |
| const_reference | operator[] (size_type i) const |
| Get the element at specific position. | |
| size_type | size () const |
| Get the number of elements in the list. | |
| void | purge () |
| Purge the list. | |
| void | clear () |
| Delete all entries from the list. | |
| ArrayList () | |
| Constructs an Array list with one chunk. | |
Static Public Attributes | |
| static constexpr int | chunkSize_ = (N > 0) ? N : 1 |
| The number of elements in one chunk of the list. This has to be at least one. The default is 100. | |
Friends | |
| class | ArrayListIterator< T, N, A > |
| The iterator needs access to the private variables. | |
| class | ConstArrayListIterator< T, N, A > |
Detailed Description
class Dune::ArrayList< T, N, A >
A dynamically growing random access list.
Internally the data is organised in a list of arrays of fixed size. Whenever the capacity of the array list is not sufficient a new std::array is allocated. In contrast to std::vector this approach prevents data copying. On the outside we provide the same interface as the stl random access containers.
While the concept sounds quite similar to std::deque there are slight but crucial differences:
- In contrast to std:deque the actual implementation (a list of arrays) is known. While for std::deque there are at least two possible implementations (dynamic array or using a double linked list.
- In contrast to std:deque there is not insert which invalidates iterators but our push_back method leaves all iterators valid.
- Additional functionality lets one delete entries before and at an iterator while moving the iterator to the next valid position.
Member Typedef Documentation
◆ const_iterator
| typedef ConstArrayListIterator<MemberType,N,A> Dune::ArrayList< T, N, A >::const_iterator |
A constant random access iterator.
◆ const_pointer
| typedef const T* Dune::ArrayList< T, N, A >::const_pointer |
The type of a const pointer to the type we store.
◆ const_reference
| typedef const T& Dune::ArrayList< T, N, A >::const_reference |
The type of a const reference to the type we store.
◆ difference_type
| typedef std::ptrdiff_t Dune::ArrayList< T, N, A >::difference_type |
The difference type.
◆ iterator
| typedef ArrayListIterator<MemberType,N,A> Dune::ArrayList< T, N, A >::iterator |
A random access iterator.
◆ MemberType
| typedef T Dune::ArrayList< T, N, A >::MemberType |
The member type that is stored.
Has to be assignable and has to have an empty constructor.
◆ pointer
| typedef T* Dune::ArrayList< T, N, A >::pointer |
The type of a pointer to the type we store.
◆ reference
| typedef T& Dune::ArrayList< T, N, A >::reference |
The type of a reference to the type we store.
◆ size_type
| typedef std::size_t Dune::ArrayList< T, N, A >::size_type |
The size type.
◆ value_type
| typedef T Dune::ArrayList< T, N, A >::value_type |
Value type for stl compliance.
Friends And Related Symbol Documentation
◆ ArrayListIterator< T, N, A >
|
friend |
The iterator needs access to the private variables.
◆ ConstArrayListIterator< T, N, A >
|
friend |
Member Data Documentation
◆ chunkSize_
|
staticconstexpr |
The number of elements in one chunk of the list. This has to be at least one. The default is 100.
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