Dune Core Modules (2.6.0)
Dune::ArrayList< T, N, A > Class Template Reference
A dynamically growing random access list. More...
#include <dune/common/arraylist.hh>
Public Types | |
enum | { chunkSize_ = (N > 0) ? N : 1 } |
typedef T | MemberType |
The member type that is stored. More... | |
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. More... | |
const_iterator | begin () const |
Get a random access iterator that is positioned at the first element. More... | |
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. More... | |
reference | operator[] (size_type i) |
Get the element at specific position. More... | |
const_reference | operator[] (size_type i) const |
Get the element at specific position. More... | |
size_type | size () const |
Get the number of elements in the list. More... | |
void | purge () |
Purge the list. More... | |
void | clear () |
Delete all entries from the list. | |
ArrayList () | |
Constructs an Array list with one chunk. | |
Detailed Description
template<class T, int N = 100, class A = std::allocator<T>>
class Dune::ArrayList< T, N, A >
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
◆ MemberType
template<class T , int N = 100, class A = std::allocator<T>>
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.
Member Enumeration Documentation
◆ anonymous enum
template<class T , int N = 100, class A = std::allocator<T>>
anonymous enum |
The documentation for this class was generated from the following file:
- dune/common/arraylist.hh
|
Legal Statements / Impressum |
Hosted by TU Dresden |
generated with Hugo v0.111.3
(Nov 24, 23:30, 2024)