61template<
typename T,
typename TAllocator, Recycling TRecycling= Recycling::Private>
64 detail::ListElement<T> >
65#if ALIB_DEBUG_CRITICAL_SECTIONS
104 ::template HookType<TAllocator, detail::ListElement<T> >;
118 template<
typename TConstOrMutableElement>
131 friend class List<T, TAllocator, TRecycling>;
148 template<
typename TMutable>
149 requires std::same_as<TMutable,
279 #if ALIB_DEBUG_CRITICAL_SECTIONS
291 List(std::initializer_list<T> initList)
292 :
List() {
for (
const auto& item : initList)
push_back(item); }
306 for(
auto& element : copy )
315 :
hook ( std::move( move.list ) )
341 :
List(pAllocator) {
for (
const auto& item : initList)
push_back(item); }
347 template<
typename TSharedRecycler= SharedRecyclerType>
348 requires(!std::same_as<TSharedRecycler , void>)
349 List(TSharedRecycler& pSharedRecycler )
362 template<
typename TSharedRecycler= SharedRecyclerType>
363 requires(!std::same_as<TSharedRecycler , void>)
364 List(TSharedRecycler& pSharedRecycler, std::initializer_list<T> initList)
365 :
List(pSharedRecycler) {
for (
const auto& item : initList)
push_back(item); }
426 recyclerType::Reset();
438 auto requiredRecyclables= ( qty
441 - recyclerType::Count();
443 if( requiredRecyclables > 0 )
444 recyclerType::Reserve( requiredRecyclables );
458 "Reference to element requested on empty containers::List" )
461 for(
integer i= 0 ; i < idx ; ++i ) {
464 "Element index out of bounds: {} >= {}" , idx, i )
475 "Reference to element requested on empty containers::List" )
478 for(
integer i= 0 ; i < idx ; ++i ) {
481 "Element index out of bounds: {} >= {}" , idx, i )
490 "Reference to element requested on empty containers::List" )
499 "Reference to element requested on empty containers::List" )
507 "Reference to element requested on empty containers::List" )
515 "Reference to element requested on empty containers::List" )
527 Element* elem= recyclerType::Get();
528 new (&elem->data) T(copy);
539 Element* elem= recyclerType::Get();
540 new (&elem->data) T(std::move(move));
550 Element* elem= recyclerType::Get();
552 new (&elem->data) T(copy);
561 Element* elem= recyclerType::Get();
563 new (&elem->data) T(std::move(move));
572 Element* elem= recyclerType::Get();
573 new (&elem->data) T(copy);
582 Element* elem= recyclerType::Get();
584 new (&elem->data) T(std::move(move));
594 template<
typename... TArgs>
596 Element* elem= recyclerType::Get();
597 new (&elem->data) T( std::forward<TArgs>(args)... );
607 template<
typename... TArgs>
609 Element* elem= recyclerType::Get();
611 new (&elem->data) T( std::forward<TArgs>(args)... );
620 template<
typename... TArgs>
622 Element* elem= recyclerType::Get();
624 new (&elem->data) T( std::forward<TArgs>(args)... );
642 "Erase requested on empty containers::List" )
644 "Iterator end() given with containers::List::erase" )
648 position.element->
remove();
649 recyclerType::Recycle( position.element );
661 "MONOMEM/LIST",
"Erase requested on empty containers::List" )
665 begin.element->remove(
end.element->prev() );
666 recyclerType::RecycleList(
begin.element,
end.element );
691template<
typename T, Recycling TRecycling = containers::Recycling::Private>
696template<
typename T, Recycling TRecycling = containers::Recycling::Private>
700template<
typename T, Recycling TRecycling = containers::Recycling::Private>
#define ALIB_DEBUG_CRITICAL_SECTIONS
#define ALIB_DCS_WITH(CS)
#define ALIB_ASSERT_ERROR(cond, domain,...)
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
List(TSharedRecycler &pSharedRecycler, std::initializer_list< T > initList)
iterator erase(const_iterator position)
integer size_type
The type defining sizes of this container.
typename detail::RecyclingSelector< TRecycling > ::template HookType< TAllocator, detail::ListElement< T > > SharedRecyclerType
AllocatorType & GetAllocator()
TAllocator AllocatorType
The allocator type that TAllocator specifies.
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.
List(TSharedRecycler &pSharedRecycler)
const_iterator end() const
List(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)
~List()
Destructor. Invokes #".Clear".
const_iterator begin() const
T & ElementAt(integer idx)
void ReserveRecyclables(integer qty, lang::ValueReference reference)
std::reverse_iterator< iterator > reverse_iterator
The mutable iterator exposed by this container.
T & emplace_front(TArgs &&... args)
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)