dune-common 2.9.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | List of all members
Dune::ArrayList< T, N, A > Class Template Reference

A dynamically growing random access list. More...

#include <dune/common/arraylist.hh>

Inheritance diagram for Dune::ArrayList< T, N, A >:
Inheritance graph

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.
 

Detailed Description

template<class T, int N = 100, class A = std::allocator<T>>
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:

Member Typedef Documentation

◆ const_iterator

template<class T , int N = 100, class A = std::allocator<T>>
typedef ConstArrayListIterator<MemberType,N,A> Dune::ArrayList< T, N, A >::const_iterator

A constant random access iterator.

◆ const_pointer

template<class T , int N = 100, class A = std::allocator<T>>
typedef const T* Dune::ArrayList< T, N, A >::const_pointer

The type of a const pointer to the type we store.

◆ const_reference

template<class T , int N = 100, class A = std::allocator<T>>
typedef const T& Dune::ArrayList< T, N, A >::const_reference

The type of a const reference to the type we store.

◆ difference_type

template<class T , int N = 100, class A = std::allocator<T>>
typedef std::ptrdiff_t Dune::ArrayList< T, N, A >::difference_type

The difference type.

◆ iterator

template<class T , int N = 100, class A = std::allocator<T>>
typedef ArrayListIterator<MemberType,N,A> Dune::ArrayList< T, N, A >::iterator

A random access iterator.

◆ 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.

◆ pointer

template<class T , int N = 100, class A = std::allocator<T>>
typedef T* Dune::ArrayList< T, N, A >::pointer

The type of a pointer to the type we store.

◆ reference

template<class T , int N = 100, class A = std::allocator<T>>
typedef T& Dune::ArrayList< T, N, A >::reference

The type of a reference to the type we store.

◆ size_type

template<class T , int N = 100, class A = std::allocator<T>>
typedef std::size_t Dune::ArrayList< T, N, A >::size_type

The size type.

◆ value_type

template<class T , int N = 100, class A = std::allocator<T>>
typedef T Dune::ArrayList< T, N, A >::value_type

Value type for stl compliance.

Member Data Documentation

◆ chunkSize_

template<class T , int N = 100, class A = std::allocator<T>>
constexpr int Dune::ArrayList< T, N, A >::chunkSize_ = (N > 0) ? N : 1
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: