ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::containers::List< TAllocator, T, TRecycling > Class Template Reference

Description:

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
class alib::containers::List< TAllocator, T, TRecycling >

Implements a doubly linked list, likewise std::list does. Memory for inserted elements is allocated using the Allocator provided with construction.

Elements that are erased from the list will by default be recycled with subsequent insert operations. With that, remove and insert operations do not lead to leaked memory when a monotonic allocator is used.

This type is not a full re-write of type std::list. Among others, as of today, methods splice, merge, or sort are not provided.

See also
Template Parameters
TAllocatorThe allocator type to use.
TThe type of the contained objects.
TRecyclingDenotes the type of recycling that is to be performed. Possible values are None, Private (the default), or Shared.

Definition at line 57 of file list.inl.

Inheritance diagram for alib::containers::List< TAllocator, T, TRecycling >:
[legend]
Collaboration diagram for alib::containers::List< TAllocator, T, TRecycling >:
[legend]

Inner Type Index:

struct  TIterator
 

Public Type Index:

using AllocatorType = TAllocator
 The allocator type that TAllocator specifies.
 
using const_iterator = TIterator<const T>
 The constant iterator exposed by this container.
 
using const_reverse_iterator = std::reverse_iterator<const_iterator>
 The constant iterator exposed by this container.
 
using iterator = TIterator< T>
 The mutable iterator exposed by this container.
 
using reverse_iterator = std::reverse_iterator<iterator>
 The mutable iterator exposed by this container.
 
using SharedRecyclerType
 
using size_type = integer
 The type defining sizes of this container.
 
using value_type = T
 Exposes template parameter T to the outer world in a std compatible way.
 

Public Method Index:

std::iterator_traits Interface
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator crend () const
 
 List ()
 
 List (std::initializer_list< T > initList)
 
 List (const List &copy)
 
 List (List &&move)
 
 List (AllocatorType &pAllocator)
 
 List (AllocatorType &pAllocator, std::initializer_list< T > initList)
 
template<typename TSharedRecycler = SharedRecyclerType>
requires (!std::same_as<TSharedRecycler , void>)
 List (TSharedRecycler &pSharedRecycler)
 
template<typename TSharedRecycler = SharedRecyclerType>
requires (!std::same_as<TSharedRecycler , void>)
 List (TSharedRecycler &pSharedRecycler, std::initializer_list< T > initList)
 
 ~List ()
 Destructor. Invokes Clear.
 
Allocation
AllocatorTypeGetAllocator ()
 
integer RecyclablesCount () const
 
Size and Capacity
integer size () const
 
bool empty () const
 
bool IsNotEmpty () const
 
void Clear ()
 
void Reset ()
 
void ReserveRecyclables (integer qty, lang::ValueReference reference)
 
Element Access
T & ElementAt (integer idx)
 
const T & ElementAt (integer idx) const
 
T & front ()
 
const T & front () const
 
T & back ()
 
const T & back () const
 
Element Insertion
iterator Insert (const_iterator position, const T &copy)
 
iterator Insert (const_iterator position, T &&move)
 
T & push_back (const T &copy)
 
T & push_back (T &&move)
 
T & push_front (const T &copy)
 
T & push_front (T &&move)
 
template<typename... TArgs>
iterator emplace (const_iterator position, TArgs &&... args)
 
template<typename... TArgs>
T & emplace_back (TArgs &&... args)
 
template<typename... TArgs>
T & emplace_front (TArgs &&... args)
 
Element Removal
iterator erase (const_iterator position)
 
iterator erase (const_iterator begin, const_iterator end)
 
void pop_front ()
 Removes the first element.
 
void pop_back ()
 Removes the last element.
 
- Public Method Index: inherited from alib::lang::DbgCriticalSections
 DbgCriticalSections (const char *name)
 
 ~DbgCriticalSections ()
 Destructor. Checks that this instance is unused.
 
ALIB_DLL void Acquire (const CallerInfo &ci) const
 
ALIB_DLL void AcquireShared (const CallerInfo &ci) const
 
ALIB_DLL void doAssert (bool cond, const CallerInfo &ciAssert, const CallerInfo &ci, const char *headline) const
 
ALIB_DLL void Release (const CallerInfo &ci) const
 
ALIB_DLL void ReleaseShared (const CallerInfo &ci) const
 
void yieldOrSleep () const
 

Protected Type Index:

using allocBase = lang::AllocatorMember<TAllocator>
 The allocator type that TAllocator specifies.
 
using Element = detail::ListElement<T>
 The list element type.
 
using hook = lang::BidiListHook<detail::ListElement<T>>
 The allocator type that TAllocator specifies.
 
using recyclerType
 The recycler type.
 

Additional Inherited Members

- Public Static Field Index: inherited from alib::lang::DbgCriticalSections
static ALIB_DLL const char * ASSERTION_FORMAT
 
- Public Field Index: inherited from alib::lang::DbgCriticalSections
CallerInfo DCSAcq
 Source location of acquirement.
 
AssociatedLockDCSLock {nullptr}
 
const char * DCSName
 The name of this DCS. Used for debug-output.
 
std::atomic< int > DCSReaderCnt {0}
 Tracks enter/exit calls of readers.
 
CallerInfo DCSRel
 Source location of the last "reader" seen.
 
CallerInfo DCSSAcq
 Source location of acquirement.
 
CallerInfo DCSSRel
 Source location of the last "reader" seen.
 
std::atomic< int > DCSWriterCnt {0}
 Tracks enter/exit calls (including readers)
 
int DCSYieldOrSleepTimeInNS = -1
 
- Private Type Index: inherited from alib::lang::BidiListHook< detail::ListElement< T > >
using TFNode
 An alias for the base type of the node type of this list.
 
using TFNode
 An alias for the base type of the node type of this list.
 
using TNode
 An alias for the node type of this list.
 
using TNode
 An alias for the node type of this list.
 
- Private Field Index: inherited from alib::lang::BidiListHook< detail::ListElement< T > >
TNode hook
 The root node. Points twice to itself when the list is empty.
 
TNode hook
 The root node. Points twice to itself when the list is empty.
 
- Private Method Index: inherited from alib::lang::BidiListHook< detail::ListElement< T > >
 BidiListHook () noexcept
 Default constructor. Initializes this list to be empty.
 
 BidiListHook () noexcept
 Default constructor. Initializes this list to be empty.
 
 BidiListHook (BidiListHook &&move) noexcept
 
 BidiListHook (BidiListHook &&move) noexcept
 
 BidiListHook (const BidiListHook &)=delete
 Deleted copy constructor.
 
 BidiListHook (const BidiListHook &)=delete
 Deleted copy constructor.
 
 BidiListHook (detail::ListElement< T > *first) noexcept
 
 BidiListHook (detail::ListElement< T > *first) noexcept
 
 BidiListHook (detail::ListElement< T > *first, detail::ListElement< T > *last) noexcept
 
 BidiListHook (detail::ListElement< T > *first, detail::ListElement< T > *last) noexcept
 
integer count (const TNode *end=nullptr) const noexcept
 
integer count (const TNode *end=nullptr) const noexcept
 
detail::ListElement< T > * end () const noexcept
 
detail::ListElement< T > * end () const noexcept
 
detail::ListElement< T > * first () const noexcept
 
detail::ListElement< T > * first () const noexcept
 
bool isEmpty () const noexcept
 
bool isEmpty () const noexcept
 
bool isFirst (const detail::ListElement< T > *elem) const noexcept
 
bool isFirst (const detail::ListElement< T > *elem) const noexcept
 
bool isLast (const detail::ListElement< T > *elem) const noexcept
 
bool isLast (const detail::ListElement< T > *elem) const noexcept
 
detail::ListElement< T > * last () const noexcept
 
detail::ListElement< T > * last () const noexcept
 
BidiListHookoperator= (BidiListHook &&) noexcept=default
 
BidiListHookoperator= (BidiListHook &&) noexcept=default
 
BidiListHookoperator= (const BidiListHook &)=delete
 
BidiListHookoperator= (const BidiListHook &)=delete
 
detail::ListElement< T > * popEnd () noexcept
 
detail::ListElement< T > * popEnd () noexcept
 
detail::ListElement< T > * popFront () noexcept
 
detail::ListElement< T > * popFront () noexcept
 
void pushEnd (detail::ListElement< T > *elem) noexcept
 
void pushEnd (detail::ListElement< T > *elem) noexcept
 
void pushEnd (detail::ListElement< T > *first, detail::ListElement< T > *last) noexcept
 
void pushEnd (detail::ListElement< T > *first, detail::ListElement< T > *last) noexcept
 
void pushFront (detail::ListElement< T > *elem) noexcept
 
void pushFront (detail::ListElement< T > *elem) noexcept
 
void pushFront (detail::ListElement< T > *first, detail::ListElement< T > *last) noexcept
 
void pushFront (detail::ListElement< T > *first, detail::ListElement< T > *last) noexcept
 
void reset () noexcept
 Resets this list to zero elements.
 
void reset () noexcept
 Resets this list to zero elements.
 

Type Definition Details:

◆ AllocatorType

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
using alib::containers::List< TAllocator, T, TRecycling >::AllocatorType = TAllocator

The allocator type that TAllocator specifies.

Definition at line 90 of file list.inl.

◆ allocBase

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
using alib::containers::List< TAllocator, T, TRecycling >::allocBase = lang::AllocatorMember<TAllocator>
protected

The allocator type that TAllocator specifies.

Definition at line 72 of file list.inl.

◆ const_iterator

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
using alib::containers::List< TAllocator, T, TRecycling >::const_iterator = TIterator<const T>

The constant iterator exposed by this container.

Definition at line 218 of file list.inl.

◆ const_reverse_iterator

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
using alib::containers::List< TAllocator, T, TRecycling >::const_reverse_iterator = std::reverse_iterator<const_iterator>

The constant iterator exposed by this container.

Definition at line 224 of file list.inl.

◆ Element

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
using alib::containers::List< TAllocator, T, TRecycling >::Element = detail::ListElement<T>
protected

The list element type.

Definition at line 75 of file list.inl.

◆ hook

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
using alib::containers::List< TAllocator, T, TRecycling >::hook = lang::BidiListHook<detail::ListElement<T>>
protected

The allocator type that TAllocator specifies.

Definition at line 69 of file list.inl.

◆ iterator

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
using alib::containers::List< TAllocator, T, TRecycling >::iterator = TIterator< T>

The mutable iterator exposed by this container.

Definition at line 221 of file list.inl.

◆ recyclerType

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
using alib::containers::List< TAllocator, T, TRecycling >::recyclerType
protected
Initial value:

The recycler type.

Definition at line 78 of file list.inl.

◆ reverse_iterator

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
using alib::containers::List< TAllocator, T, TRecycling >::reverse_iterator = std::reverse_iterator<iterator>

The mutable iterator exposed by this container.

Definition at line 227 of file list.inl.

◆ SharedRecyclerType

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
using alib::containers::List< TAllocator, T, TRecycling >::SharedRecyclerType
Initial value:
::template HookType<TAllocator, detail::ListElement<T> >

This type definition may be used to define an externally managed shared recycler, which can be passed to the alternative constructor of this class when template parameter TRecycling equals Shared.

See also
Chapter 4.3 Shared Recycling of the Programmer's Manual for this ALib Module.

Definition at line 98 of file list.inl.

◆ size_type

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
using alib::containers::List< TAllocator, T, TRecycling >::size_type = integer

The type defining sizes of this container.

Definition at line 86 of file list.inl.

◆ value_type

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
using alib::containers::List< TAllocator, T, TRecycling >::value_type = T

Exposes template parameter T to the outer world in a std compatible way.

Definition at line 83 of file list.inl.

Constructor(s) / Destructor Details:

◆ List() [1/8]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
alib::containers::List< TAllocator, T, TRecycling >::List ( )
inline

Constructor neither requiring an allocator, nor a shared recycler.

Note
This constructor is not available if the template argument TRecycling equals Shared and if argument TAllocator does not equal type HeapAllocator.

Definition at line 290 of file list.inl.

◆ List() [2/8]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
alib::containers::List< TAllocator, T, TRecycling >::List ( std::initializer_list< T > initList)
inline

Constructor that takes an initializer list, but neither a n allocator, nor a shared recycler.

Note
This constructor is not available if the template argument TRecycling equals Shared.
Parameters
initListThe initial lists of elements to add.

Definition at line 303 of file list.inl.

◆ List() [3/8]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
alib::containers::List< TAllocator, T, TRecycling >::List ( const List< TAllocator, T, TRecycling > & copy)
inline

Copy constructor. Invokes implementation dependent copy constructor of recycler, copies the pointer to the allocator and then copies each element.

Parameters
copyThe list to copy.

Definition at line 314 of file list.inl.

◆ List() [4/8]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
alib::containers::List< TAllocator, T, TRecycling >::List ( List< TAllocator, T, TRecycling > && move)
inline

Move constructor. Invokes implementation dependent move constructor of recycler, moves the pointer to the allocator and then copies each element.

Parameters
moveThe private recycler to move.

Definition at line 330 of file list.inl.

◆ List() [5/8]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
alib::containers::List< TAllocator, T, TRecycling >::List ( AllocatorType & pAllocator)
inline

Constructor accepting an allocator.

Note
This constructor is not available if the template argument TRecycling equals Shared and if argument TAllocator does not equal type HeapAllocator.
Parameters
pAllocatorThe allocator to use.

Definition at line 342 of file list.inl.

◆ List() [6/8]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
alib::containers::List< TAllocator, T, TRecycling >::List ( AllocatorType & pAllocator,
std::initializer_list< T > initList )
inline

Constructor that takes an allocator and an initializer list.

Note
This constructor is not available if the template argument TRecycling equals Shared.
Parameters
pAllocatorThe allocator to use.
initListThe initial lists of elements to add.

Definition at line 357 of file list.inl.

◆ List() [7/8]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
template<typename TSharedRecycler = SharedRecyclerType>
requires (!std::same_as<TSharedRecycler , void>)
alib::containers::List< TAllocator, T, TRecycling >::List ( TSharedRecycler & pSharedRecycler)
inline

Constructor taking a shared recycler. This constructor is not available if the template argument TRecycling does not equal Shared.

Parameters
pSharedRecyclerThe shared recycler.

Definition at line 370 of file list.inl.

◆ List() [8/8]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
template<typename TSharedRecycler = SharedRecyclerType>
requires (!std::same_as<TSharedRecycler , void>)
alib::containers::List< TAllocator, T, TRecycling >::List ( TSharedRecycler & pSharedRecycler,
std::initializer_list< T > initList )
inline

Constructor taking a shared recycler and an initializer list. This constructor is not available if the template argument TRecycling does not equal Shared.

Parameters
pSharedRecyclerThe shared recycler.
initListThe initial lists of elements to add.

Definition at line 385 of file list.inl.

◆ ~List()

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
alib::containers::List< TAllocator, T, TRecycling >::~List ( )
inline

Destructor. Invokes Clear.

Definition at line 393 of file list.inl.

Method Details:

◆ back() [1/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
T & alib::containers::List< TAllocator, T, TRecycling >::back ( )
inline

Returns a non-constant reference to the last object of the list.

Returns
A mutable reference to T.

Definition at line 546 of file list.inl.

◆ back() [2/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
const T & alib::containers::List< TAllocator, T, TRecycling >::back ( ) const
inline

Returns a constant reference to the last object of the list.

Returns
A constant reference to T.

Definition at line 555 of file list.inl.

◆ begin() [1/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
iterator alib::containers::List< TAllocator, T, TRecycling >::begin ( )
inline

Returns an iterator pointing to a mutable value at the start of this list.

Returns
The start of this list.

Definition at line 234 of file list.inl.

◆ begin() [2/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
const_iterator alib::containers::List< TAllocator, T, TRecycling >::begin ( ) const
inline

Returns an iterator pointing to a constant value at the start of this list.

Returns
The start of this list.

Definition at line 242 of file list.inl.

◆ cbegin()

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
const_iterator alib::containers::List< TAllocator, T, TRecycling >::cbegin ( ) const
inline

Returns an iterator pointing to a constant value at the start of this list.

Returns
The start of this list.

Definition at line 250 of file list.inl.

◆ cend()

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
const_iterator alib::containers::List< TAllocator, T, TRecycling >::cend ( ) const
inline

Returns an iterator pointing to the first element behind this list.

Returns
The end of this list.

Definition at line 254 of file list.inl.

◆ Clear()

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
void alib::containers::List< TAllocator, T, TRecycling >::Clear ( )
inline

Invokes the destructor of all elements and empties the list. All allocated internal elements are kept for future recycling.

Definition at line 437 of file list.inl.

◆ crbegin()

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
const_reverse_iterator alib::containers::List< TAllocator, T, TRecycling >::crbegin ( ) const
inline

Returns a reverse iterator pointing to a constant value at the end of this list.

Returns
The start of this list.

Definition at line 274 of file list.inl.

◆ crend()

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
const_reverse_iterator alib::containers::List< TAllocator, T, TRecycling >::crend ( ) const
inline

Returns a reverse iterator pointing to the first element behind the start of this list.

Returns
The end of this list.

Definition at line 278 of file list.inl.

◆ ElementAt() [1/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
T & alib::containers::List< TAllocator, T, TRecycling >::ElementAt ( integer idx)
inline

Traverses the list to return the item with the given idx. (Executes in linear time O(N).)

Parameters
idxThe index of the element to retrieve.
Returns
A mutable reference to T.

Definition at line 491 of file list.inl.

◆ ElementAt() [2/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
const T & alib::containers::List< TAllocator, T, TRecycling >::ElementAt ( integer idx) const
inline

Traverses the list to return the item with the given idx. (Executes in linear time O(N).)

Parameters
idxThe index of the element to retrieve.
Returns
A constant reference to T.

Definition at line 510 of file list.inl.

◆ emplace()

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
template<typename... TArgs>
iterator alib::containers::List< TAllocator, T, TRecycling >::emplace ( const_iterator position,
TArgs &&... args )
inline

Adds a new element before the given position.

Template Parameters
TArgsTypes of variadic parameters given with parameter args.
Parameters
positionThe position to emplace the new element.
argsVariadic parameters to be forwarded to the constructor of type T.
Returns
A constant reference to the element added.

Definition at line 644 of file list.inl.

◆ emplace_back()

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
template<typename... TArgs>
T & alib::containers::List< TAllocator, T, TRecycling >::emplace_back ( TArgs &&... args)
inline

Adds a new element at the end of the list.

Template Parameters
TArgsTypes of variadic parameters given with parameter args.
Parameters
argsVariadic parameters to be forwarded to the constructor of type T.
Returns
A reference to the element added.

Definition at line 658 of file list.inl.

◆ emplace_front()

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
template<typename... TArgs>
T & alib::containers::List< TAllocator, T, TRecycling >::emplace_front ( TArgs &&... args)
inline

Adds a new element at the end of the list.

Template Parameters
TArgsTypes of variadic parameters given with parameter args.
Parameters
argsVariadic parameters to be forwarded to the constructor of type T.
Returns
A reference to the element added.

Definition at line 672 of file list.inl.

◆ empty()

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
bool alib::containers::List< TAllocator, T, TRecycling >::empty ( ) const
inline

Tests this container for emptiness.

Returns
true if this list is empty, false otherwise.

Definition at line 429 of file list.inl.

◆ end() [1/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
iterator alib::containers::List< TAllocator, T, TRecycling >::end ( )
inline

Returns an iterator pointing to the first element behind this list.

Returns
The end of this list.

Definition at line 238 of file list.inl.

◆ end() [2/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
const_iterator alib::containers::List< TAllocator, T, TRecycling >::end ( ) const
inline

Returns an iterator pointing to the first element behind this list.

Returns
The end of this list.

Definition at line 246 of file list.inl.

◆ erase() [1/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
iterator alib::containers::List< TAllocator, T, TRecycling >::erase ( const_iterator begin,
const_iterator end )
inline

Removes a range of elements defined by iterators first and last.

Parameters
beginThe start of the range to remove.
endThe first element behind the range to remove.
Returns
A mutable iterator referring to the given last.

Definition at line 712 of file list.inl.

◆ erase() [2/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
iterator alib::containers::List< TAllocator, T, TRecycling >::erase ( const_iterator position)
inline

Removes an element at the given position.

Parameters
positionA constant iterator pointing to the element to be removed. Mutable iterators are inherently converted with the invocation of this method.
Returns
A mutable iterator pointing behind the removed element. If position refers to the last element of the list, iterator end() is returned.

Definition at line 692 of file list.inl.

◆ front() [1/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
T & alib::containers::List< TAllocator, T, TRecycling >::front ( )
inline

Returns a non-constant reference to the first object of the list.

Returns
A mutable reference to T.

Definition at line 527 of file list.inl.

◆ front() [2/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
const T & alib::containers::List< TAllocator, T, TRecycling >::front ( ) const
inline

Returns a constant reference to the first object of the list.

Returns
A constant reference to T.

Definition at line 537 of file list.inl.

◆ GetAllocator()

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
AllocatorType & alib::containers::List< TAllocator, T, TRecycling >::GetAllocator ( )
inline

Returns the allocator that was passed to the constructor of this container.

Returns
The allocator this container uses.

Definition at line 404 of file list.inl.

◆ Insert() [1/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
iterator alib::containers::List< TAllocator, T, TRecycling >::Insert ( const_iterator position,
const T & copy )
inline

Adds a new element before the given position.

Parameters
positionThe position to emplace the new element.
copyThe value to copy and insert.
Returns
A constant reference to the element added.

Definition at line 569 of file list.inl.

◆ Insert() [2/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
iterator alib::containers::List< TAllocator, T, TRecycling >::Insert ( const_iterator position,
T && move )
inline

Moves a value into this container before the given position.

Parameters
positionThe position to emplace the new element.
moveThe value to move into this container.
Returns
A constant reference to the element moved.

Definition at line 582 of file list.inl.

◆ IsNotEmpty()

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
bool alib::containers::List< TAllocator, T, TRecycling >::IsNotEmpty ( ) const
inline

Tests this container for emptiness.

Returns
true if this list is empty, false otherwise.

Definition at line 433 of file list.inl.

◆ pop_back()

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
void alib::containers::List< TAllocator, T, TRecycling >::pop_back ( )
inline

Removes the last element.

Definition at line 733 of file list.inl.

◆ pop_front()

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
void alib::containers::List< TAllocator, T, TRecycling >::pop_front ( )
inline

Removes the first element.

Definition at line 726 of file list.inl.

◆ push_back() [1/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
T & alib::containers::List< TAllocator, T, TRecycling >::push_back ( const T & copy)
inline

Adds a new element at the end of the list.

Parameters
copyThe value to copy and insert.
Returns
A reference to the element added.

Definition at line 594 of file list.inl.

◆ push_back() [2/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
T & alib::containers::List< TAllocator, T, TRecycling >::push_back ( T && move)
inline

Moves a value to the end of this list.

Parameters
moveThe value to move into this container.
Returns
A reference to the element moved.

Definition at line 606 of file list.inl.

◆ push_front() [1/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
T & alib::containers::List< TAllocator, T, TRecycling >::push_front ( const T & copy)
inline

Adds a new element at the start of the list.

Parameters
copyThe value to copy and insert.
Returns
A reference to the element added.

Definition at line 618 of file list.inl.

◆ push_front() [2/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
T & alib::containers::List< TAllocator, T, TRecycling >::push_front ( T && move)
inline

Moves a value to the start of this list.

Parameters
moveThe value to move into this container.
Returns
A reference to the element moved.

Definition at line 629 of file list.inl.

◆ rbegin() [1/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
reverse_iterator alib::containers::List< TAllocator, T, TRecycling >::rbegin ( )
inline

Returns a reverse iterator pointing to a mutable value at the end of this list.

Returns
The start of this list.

Definition at line 258 of file list.inl.

◆ rbegin() [2/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
const_reverse_iterator alib::containers::List< TAllocator, T, TRecycling >::rbegin ( ) const
inline

Returns a reverse iterator pointing to a constant value at the end of this list.

Returns
The start of this list.

Definition at line 266 of file list.inl.

◆ RecyclablesCount()

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
integer alib::containers::List< TAllocator, T, TRecycling >::RecyclablesCount ( ) const
inline

Counts the number of currently allocated but unused (not contained) list elements that will be recycled with upcoming insertions.

Note
This method is provided for completeness and unit-testing. It should not be of relevance for common usage.
Furthermore, this method is not available (aka does not compile) with instantiations that specify template parameter TRecycling as None.
Returns
The number of removed and not yet recycled elements.

Definition at line 417 of file list.inl.

◆ rend() [1/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
reverse_iterator alib::containers::List< TAllocator, T, TRecycling >::rend ( )
inline

Returns a reverse iterator pointing to the first element behind the start of this list.

Returns
The end of this list.

Definition at line 262 of file list.inl.

◆ rend() [2/2]

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
const_reverse_iterator alib::containers::List< TAllocator, T, TRecycling >::rend ( ) const
inline

Returns a reverse iterator pointing to the first element behind the start of this list.

Returns
The end of this list.

Definition at line 270 of file list.inl.

◆ ReserveRecyclables()

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
void alib::containers::List< TAllocator, T, TRecycling >::ReserveRecyclables ( integer qty,
lang::ValueReference reference )
inline

Allocates the required memory for the number of additional elements expected.

See also
Chapter 4.5 Reserving Capacity of the Programmer's Manual.
Parameters
qtyThe expected resulting number (or increase) of elements to be stored in this container.
referenceDenotes whether qty is meant as an absolute size or an increase.

Definition at line 471 of file list.inl.

◆ Reset()

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
void alib::containers::List< TAllocator, T, TRecycling >::Reset ( )
inline

Same as clear, but does not recycle internal nodes. Furthermore, all recyclables are deleted. The latter is done only if recycling type is not Shared. In this case, the elements are still recycled.

This method is useful with monotonic allocators, that can be reset as well, after this instance is reset.

Definition at line 453 of file list.inl.

◆ size()

template<typename TAllocator, typename T, Recycling TRecycling = Recycling::Private>
integer alib::containers::List< TAllocator, T, TRecycling >::size ( ) const
inline

Evaluates the size of the list by traversing all elements.

Returns
The number of elements contained in this listed.

Definition at line 425 of file list.inl.


The documentation for this class was generated from the following file: