dune-common 2.9.0
|
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. | |
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:
typedef ConstArrayListIterator<MemberType,N,A> Dune::ArrayList< T, N, A >::const_iterator |
A constant random access iterator.
typedef const T* Dune::ArrayList< T, N, A >::const_pointer |
The type of a const pointer to the type we store.
typedef const T& Dune::ArrayList< T, N, A >::const_reference |
The type of a const reference to the type we store.
typedef std::ptrdiff_t Dune::ArrayList< T, N, A >::difference_type |
The difference type.
typedef ArrayListIterator<MemberType,N,A> Dune::ArrayList< T, N, A >::iterator |
A random access iterator.
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.
typedef T* Dune::ArrayList< T, N, A >::pointer |
The type of a pointer to the type we store.
typedef T& Dune::ArrayList< T, N, A >::reference |
The type of a reference to the type we store.
typedef std::size_t Dune::ArrayList< T, N, A >::size_type |
The size type.
typedef T Dune::ArrayList< T, N, A >::value_type |
Value type for stl compliance.
|
staticconstexpr |
The number of elements in one chunk of the list. This has to be at least one. The default is 100.