57template<
typename T,
typename TAllocator, Recycling TRecycling= Recycling::Private>
60 detail::ListElement<T> >
61#if ALIB_DEBUG_CRITICAL_SECTIONS
100 ::template HookType<TAllocator, detail::ListElement<T> >;
114 template<
typename TConstOrMutableElement>
127 friend class List<T, TAllocator, TRecycling>;
144 template<
typename TMutable>
145 requires std::same_as<TMutable,
275 #if ALIB_DEBUG_CRITICAL_SECTIONS
287 List(std::initializer_list<T> initList)
288 :
List() {
for (
const auto& item : initList)
push_back(item); }
302 for(
auto& element : copy )
311 :
hook ( std::move( move.list ) )
337 :
List(pAllocator) {
for (
const auto& item : initList)
push_back(item); }
343 template<
typename TSharedRecycler= SharedRecyclerType>
344 requires(!std::same_as<TSharedRecycler , void>)
345 List(TSharedRecycler& pSharedRecycler )
358 template<
typename TSharedRecycler= SharedRecyclerType>
359 requires(!std::same_as<TSharedRecycler , void>)
360 List(TSharedRecycler& pSharedRecycler, std::initializer_list<T> initList)
361 :
List(pSharedRecycler) {
for (
const auto& item : initList)
push_back(item); }
422 recyclerType::Reset();
434 auto requiredRecyclables= ( qty
437 - recyclerType::Count();
439 if( requiredRecyclables > 0 )
440 recyclerType::Reserve( requiredRecyclables );
454 "Reference to element requested on empty containers::List" )
457 for(
integer i= 0 ; i < idx ; ++i ) {
460 "Element index out of bounds: {} >= {}" , idx, i )
471 "Reference to element requested on empty containers::List" )
474 for(
integer i= 0 ; i < idx ; ++i ) {
477 "Element index out of bounds: {} >= {}" , idx, i )
486 "Reference to element requested on empty containers::List" )
495 "Reference to element requested on empty containers::List" )
503 "Reference to element requested on empty containers::List" )
511 "Reference to element requested on empty containers::List" )
523 Element* elem= recyclerType::Get();
524 new (&elem->data) T(copy);
535 Element* elem= recyclerType::Get();
536 new (&elem->data) T(std::move(move));
546 Element* elem= recyclerType::Get();
548 new (&elem->data) T(copy);
557 Element* elem= recyclerType::Get();
559 new (&elem->data) T(std::move(move));
568 Element* elem= recyclerType::Get();
569 new (&elem->data) T(copy);
578 Element* elem= recyclerType::Get();
580 new (&elem->data) T(std::move(move));
590 template<
typename... TArgs>
592 Element* elem= recyclerType::Get();
593 new (&elem->data) T( std::forward<TArgs>(args)... );
603 template<
typename... TArgs>
605 Element* elem= recyclerType::Get();
607 new (&elem->data) T( std::forward<TArgs>(args)... );
616 template<
typename... TArgs>
618 Element* elem= recyclerType::Get();
620 new (&elem->data) T( std::forward<TArgs>(args)... );
638 "Erase requested on empty containers::List" )
640 "Iterator end() given with containers::List::erase" )
644 position.element->
remove();
645 recyclerType::Recycle( position.element );
657 "MONOMEM/LIST",
"Erase requested on empty containers::List" )
661 begin.element->remove(
end.element->prev() );
662 recyclerType::RecycleList(
begin.element,
end.element );
687template<
typename T, Recycling TRecycling = containers::Recycling::Private>
692template<
typename T, Recycling TRecycling = containers::Recycling::Private>
696template<
typename T, Recycling TRecycling = containers::Recycling::Private>
reverse_iterator rbegin()
iterator Insert(const_iterator position, T &&move)
iterator Insert(const_iterator position, const T ©)
const T & ElementAt(integer idx) const
const_iterator cend() const
const_reverse_iterator crend() const
iterator erase(const_iterator position)
integer size_type
The type defining sizes of this container.
List(TSharedRecycler &pSharedRecycler)
AllocatorType & GetAllocator()
const_iterator cbegin() const
iterator erase(const_iterator begin, const_iterator end)
typename detail::RecyclingSelector< TRecycling >::template Type< TAllocator, detail::ListElement< T > > recyclerType
The recycler type.
const_iterator end() const
List(std::initializer_list< T > initList)
List(TSharedRecycler &pSharedRecycler, std::initializer_list< T > initList)
std::reverse_iterator< const_iterator > const_reverse_iterator
The constant iterator exposed by this container.
T & push_front(const T ©)
lang::BidiListHook< detail::ListElement< T > > hook
The hook type.
iterator emplace(const_iterator position, TArgs &&... args)
integer RecyclablesCount() const
detail::ListElement< T > Element
The list element type.
const_reverse_iterator rend() const
TIterator< T > iterator
The mutable iterator exposed by this container.
T & push_back(const T ©)
void pop_back()
Removes the last element.
lang::AllocatorMember< TAllocator > allocBase
The type of the base class that stores the allocator.
List(AllocatorType &pAllocator)
T value_type
Exposes template parameter T to the outer world in a std compatible way.
List(AllocatorType &pAllocator, std::initializer_list< T > initList)
void pop_front()
Removes the first element.
const_reverse_iterator crbegin() const
const_reverse_iterator rbegin() const
TIterator< const T > const_iterator
The constant iterator exposed by this container.
T & emplace_back(TArgs &&... args)
TAllocator AllocatorType
The allocator type that TAllocator specifies.
~List()
Destructor. Invokes Clear.
const_iterator begin() const
T & ElementAt(integer idx)
void ReserveRecyclables(integer qty, lang::ValueReference reference)
typename detail::RecyclingSelector< TRecycling > ::template HookType< TAllocator, detail::ListElement< T > > SharedRecyclerType
std::reverse_iterator< iterator > reverse_iterator
The mutable iterator exposed by this container.
T & emplace_front(TArgs &&... args)
#define ALIB_DCS_WITH(CS)
#define ALIB_ASSERT_ERROR(cond, domain,...)
#define ALIB_DEBUG_CRITICAL_SECTIONS
Detail namespace of module ALib Containers.
ValueReference
Denotes if a value is interpreted as an absolute or relative number.
@ Absolute
Referring to an absolute value.
containers::List< T, MonoAllocator, TRecycling > ListMA
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
containers::List< T, PoolAllocator, TRecycling > ListPA
Type alias in namespace alib.
containers::List< T, HeapAllocator, TRecycling > List
Type alias in namespace alib.
TConstOrMutableElement * pointer
Implementation of std::iterator_traits.
TConstOrMutableElement * operator->() const
integer difference_type
Implementation of std::iterator_traits.
TConstOrMutableElement & reference
Implementation of std::iterator_traits.
TIterator()=default
Default constructor creating an invalid iterator.
TConstOrMutableElement & operator*() const
std::bidirectional_iterator_tag iterator_category
Implementation of std::iterator_traits.
TIterator operator--(int)
bool operator!=(TIterator other) const
TIterator(const TMutable &mutableIt)
TConstOrMutableElement value_type
Implementation of std::iterator_traits.
TIterator operator++(int)
bool operator==(TIterator other) const
TIterator(Element *start)
Extents BidiNodeBase by an value of type T.
T data
The custom data object.
TAllocator & GetAllocator() const noexcept
detail::ListElement< T > * first() const noexcept
detail::ListElement< T > * popFront() noexcept
integer count(const TNode *end=nullptr) const noexcept
detail::ListElement< T > * popEnd() noexcept
void pushFront(detail::ListElement< T > *elem) noexcept
detail::ListElement< T > * end() const noexcept
bool isEmpty() const noexcept
void pushEnd(detail::ListElement< T > *elem) noexcept
detail::ListElement< T > * last() const noexcept
void remove() noexcept
Unhooks this node from a list.
void addBefore(TElement *elem) noexcept
DbgCriticalSections(const char *name)
void next(SidiNodeBase *p)