56template<
typename T,
typename TAllocator, Recycling TRecycling= Recycling::Private>
59 detail::ListElement<T> >
60#if ALIB_DEBUG_CRITICAL_SECTIONS
99 ::template HookType<TAllocator, detail::ListElement<T> >;
113 template<
typename TConstOrMutableElement>
125 friend class List<T, TAllocator, TRecycling>;
142 template<
typename TMutable>
143 requires std::same_as<TMutable,
273 #if ALIB_DEBUG_CRITICAL_SECTIONS
285 List(std::initializer_list<T> initList)
286 :
List() {
for (
const auto& item : initList)
push_back(item); }
300 for(
auto& element : copy )
309 :
hook ( std::move( move.list ) )
335 :
List(pAllocator) {
for (
const auto& item : initList)
push_back(item); }
341 template<
typename TSharedRecycler= SharedRecyclerType>
342 requires(!std::same_as<TSharedRecycler , void>)
343 List(TSharedRecycler& pSharedRecycler )
356 template<
typename TSharedRecycler= SharedRecyclerType>
357 requires(!std::same_as<TSharedRecycler , void>)
358 List(TSharedRecycler& pSharedRecycler, std::initializer_list<T> initList)
359 :
List(pSharedRecycler) {
for (
const auto& item : initList)
push_back(item); }
420 recyclerType::Reset();
432 auto requiredRecyclables= ( qty
435 - recyclerType::Count();
437 if( requiredRecyclables > 0 )
438 recyclerType::Reserve( requiredRecyclables );
452 "Reference to element requested on empty containers::List" )
455 for(
integer i= 0 ; i < idx ; ++i ) {
458 "Element index out of bounds: {} >= {}" , idx, i )
469 "Reference to element requested on empty containers::List" )
472 for(
integer i= 0 ; i < idx ; ++i ) {
475 "Element index out of bounds: {} >= {}" , idx, i )
484 "Reference to element requested on empty containers::List" )
493 "Reference to element requested on empty containers::List" )
501 "Reference to element requested on empty containers::List" )
509 "Reference to element requested on empty containers::List" )
521 Element* elem= recyclerType::Get();
522 new (&elem->data) T(copy);
533 Element* elem= recyclerType::Get();
534 new (&elem->data) T(std::move(move));
544 Element* elem= recyclerType::Get();
546 new (&elem->data) T(copy);
555 Element* elem= recyclerType::Get();
557 new (&elem->data) T(std::move(move));
566 Element* elem= recyclerType::Get();
567 new (&elem->data) T(copy);
576 Element* elem= recyclerType::Get();
578 new (&elem->data) T(std::move(move));
588 template<
typename... TArgs>
590 Element* elem= recyclerType::Get();
591 new (&elem->data) T( std::forward<TArgs>(args)... );
601 template<
typename... TArgs>
603 Element* elem= recyclerType::Get();
605 new (&elem->data) T( std::forward<TArgs>(args)... );
614 template<
typename... TArgs>
616 Element* elem= recyclerType::Get();
618 new (&elem->data) T( std::forward<TArgs>(args)... );
636 "Erase requested on empty containers::List" )
638 "Iterator end() given with containers::List::erase" )
642 position.element->
remove();
643 recyclerType::Recycle( position.element );
655 "MONOMEM/LIST",
"Erase requested on empty containers::List" )
659 begin.element->remove(
end.element->prev() );
660 recyclerType::RecycleList(
begin.element,
end.element );
683template<
typename T, Recycling TRecycling = containers::Recycling::Private>
688template<
typename T, Recycling TRecycling = containers::Recycling::Private>
692template<
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)