56template<
typename TAllocator,
typename T, 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>
126 friend class List<TAllocator, T, TRecycling>;
144 template<
typename TMutable>
145 requires std::same_as<TMutable,
182 return !(*
this == other);
291 #if ALIB_DEBUG_CRITICAL_SECTIONS
303 List(std::initializer_list<T> initList)
306 for (
const auto& item : initList)
322 for(
auto& element : copy )
331 :
hook ( std::move( move.list ) )
360 for (
const auto& item : initList)
368 template<
typename TSharedRecycler= SharedRecyclerType>
369 requires(!std::same_as<TSharedRecycler , void>)
370 List(TSharedRecycler& pSharedRecycler )
383 template<
typename TSharedRecycler= SharedRecyclerType>
384 requires(!std::same_as<TSharedRecycler , void>)
385 List(TSharedRecycler& pSharedRecycler, std::initializer_list<T> initList)
386 :
List(pSharedRecycler)
388 for (
const auto& item : initList)
460 recyclerType::Reset();
473 auto requiredRecyclables= ( qty
476 - recyclerType::Count();
478 if( requiredRecyclables > 0 )
479 recyclerType::Reserve( requiredRecyclables );
494 "Reference to element requested on empty containers::List" )
497 for(
integer i= 0 ; i < idx ; ++i )
501 "Element index out of bounds: {} >= {}" , idx, i )
513 "Reference to element requested on empty containers::List" )
516 for(
integer i= 0 ; i < idx ; ++i )
520 "Element index out of bounds: {} >= {}" , idx, i )
530 "Reference to element requested on empty containers::List" )
540 "Reference to element requested on empty containers::List" )
549 "Reference to element requested on empty containers::List" )
558 "Reference to element requested on empty containers::List" )
571 Element* elem= recyclerType::Get();
572 new (&elem->data) T(copy);
584 Element* elem= recyclerType::Get();
585 new (&elem->data) T(std::move(move));
596 Element* elem= recyclerType::Get();
598 new (&elem->data) T(copy);
608 Element* elem= recyclerType::Get();
610 new (&elem->data) T(std::move(move));
620 Element* elem= recyclerType::Get();
621 new (&elem->data) T(copy);
631 Element* elem= recyclerType::Get();
633 new (&elem->data) T(std::move(move));
643 template<
typename... TArgs>
646 Element* elem= recyclerType::Get();
647 new (&elem->data) T( std::forward<TArgs>(args)... );
657 template<
typename... TArgs>
660 Element* elem= recyclerType::Get();
662 new (&elem->data) T( std::forward<TArgs>(args)... );
671 template<
typename... TArgs>
674 Element* elem= recyclerType::Get();
676 new (&elem->data) T( std::forward<TArgs>(args)... );
695 "Erase requested on empty containers::List" )
697 "Iterator end() given with containers::List::erase" )
701 position.element->
remove();
702 recyclerType::Recycle( position.element );
715 "MONOMEM/LIST",
"Erase requested on empty containers::List" )
719 begin.element->remove(
end.element->prev() );
720 recyclerType::RecycleList(
begin.element,
end.element );
745template<
typename TAllocator,
typename T, Recycling TRecycling = containers::Recycling::Private>
TIterator< const T > const_iterator
The constant iterator exposed by this container.
T value_type
Exposes template parameter T to the outer world in a std compatible way.
const T & ElementAt(integer idx) const
const_iterator end() const
TIterator< T > iterator
The mutable iterator exposed by this container.
typename detail::RecyclingSelector< TRecycling > ::template HookType< TAllocator, detail::ListElement< T > > SharedRecyclerType
iterator Insert(const_iterator position, T &&move)
typename detail::RecyclingSelector< TRecycling >::template Type< TAllocator, detail::ListElement< T > > recyclerType
The recycler type.
List(AllocatorType &pAllocator)
void pop_back()
Removes the last element.
T & emplace_back(TArgs &&... args)
const_reverse_iterator crbegin() const
List(AllocatorType &pAllocator, std::initializer_list< T > initList)
integer size_type
The type defining sizes of this container.
void ReserveRecyclables(integer qty, lang::ValueReference reference)
const_iterator cend() const
iterator Insert(const_iterator position, const T ©)
T & emplace_front(TArgs &&... args)
List(std::initializer_list< T > initList)
iterator emplace(const_iterator position, TArgs &&... args)
T & push_back(const T ©)
std::reverse_iterator< const_iterator > const_reverse_iterator
The constant iterator exposed by this container.
lang::AllocatorMember< TAllocator > allocBase
The allocator type that TAllocator specifies.
void pop_front()
Removes the first element.
T & push_front(const T ©)
~List()
Destructor. Invokes Clear.
iterator erase(const_iterator position)
iterator erase(const_iterator begin, const_iterator end)
detail::ListElement< T > Element
The list element type.
const_iterator begin() const
const_iterator cbegin() const
reverse_iterator rbegin()
T & ElementAt(integer idx)
const_reverse_iterator crend() const
integer RecyclablesCount() const
List(TSharedRecycler &pSharedRecycler, std::initializer_list< T > initList)
std::reverse_iterator< iterator > reverse_iterator
The mutable iterator exposed by this container.
List(TSharedRecycler &pSharedRecycler)
TAllocator AllocatorType
The allocator type that TAllocator specifies.
const_reverse_iterator rbegin() const
lang::BidiListHook< detail::ListElement< T > > hook
The allocator type that TAllocator specifies.
const_reverse_iterator rend() const
AllocatorType & GetAllocator()
#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.
lang::integer integer
Type alias in namespace alib.
containers::List< TAllocator, T, TRecycling > List
Type alias in namespace alib.
bool operator!=(TIterator other) const
integer difference_type
Implementation of std::iterator_traits.
TIterator(const TMutable &mutableIt)
std::bidirectional_iterator_tag iterator_category
Implementation of std::iterator_traits.
TIterator operator--(int)
TConstOrMutableElement & reference
Implementation of std::iterator_traits.
bool operator==(TIterator other) const
TIterator operator++(int)
TConstOrMutableElement value_type
Implementation of std::iterator_traits.
TConstOrMutableElement & operator*() const
TIterator()=default
Default constructor creating an invalid iterator.
TConstOrMutableElement * pointer
Implementation of std::iterator_traits.
TIterator(Element *start)
TConstOrMutableElement * operator->() const
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)