53#ifndef LIB_LINKED_ELEMENTS_H
54#define LIB_LINKED_ELEMENTS_H
70 using LERR_(INDEX_BOUNDS);
74 namespace linked_elements {
123 template<
class TY,
typename...ARGS>
127 static_assert (
"NoOwnership allocation strategy can not allocate elements");
156 ,
class ALO = linked_elements::OwningHeapAllocated<N>
208 WARN (progress,
"Failure while populating LinkedElements list. "
209 "All elements will be discarded");
251 template<
typename TY>
263 template<
class TY =N,
typename...ARGS>
267 return push (* ALO::template create<TY> (std::forward<ARGS> (args)...));
284 head_->next =
nullptr;
310 throw error::Logic (
"Attempt to access element beyond the end of LinkedElements list"
311 ,
LERR_(INDEX_BOUNDS));
321 REQUIRE (
head_,
"NIL");
322 return *(unConst(
this)->head_);
386 return * unConst(
this)->node;
416 return reinterpret_cast<Linked const&
>(anchor);
A front-end/concept to allow access to custom memory management.
Another Lumiera Forward Iterator building block, based on incorporating a state type as »*State Core*...
Intrusive single linked list, possibly taking ownership of node elements.
TY & push(TY &elm) noexcept
accept the given element and prepend it to the list of elements; depending on the allocation policy,...
LinkedElements & reverse()
Mutate the complete list to change the order of elements.
const_iterator begin() const
N & operator[](size_t index) const
LinkedElements(IT &&elements)
creating a LinkedElements list in RAII-style:
LinkedElements(LinkedElements const &)=default
IterStateWrapper< IterationState, const N & > const_iterator
IterStateWrapper< IterationState, N & > iterator
LinkedElements(LinkedElements &&rr)
TY & emplace(ARGS &&...args)
prepend object of type TY, forwarding ctor args
~LinkedElements() noexcept
LinkedElements(ALO::CustomAllocator allo)
void pushAll(IT elements)
convenience shortcut to add all the elements yielded by the given Lumiera Forward Iterator
const_iterator end() const
< Concepts and Adaptors for custom memory management
StdFactory(Allo allo=Allo{})
Create an instance of the adapter factory, forwarding to the embedded standard conforming allocator f...
Types marked with this mix-in may be moved but not copied.
Lumiera error handling (C++ interface).
#define ERROR_LOG_AND_IGNORE(_FLAG_, _OP_DESCR_)
convenience shortcut for a sequence of catch blocks just logging and consuming an error.
Helper template(s) for creating Lumiera Forward Iterators.
Implementation namespace for support and library code.
IterQueue< T > elements(T const &elm)
convenience free function to build an iterable sequence
auto & asLinkedElements(N *const &anchor)
transiently reinterpret an element pointer as const LinkedElements, allowing to count,...
LumieraError< LERR_(LOGIC)> Logic
OBJ * unConst(const OBJ *)
shortcut to save some typing when having to define const and non-const variants of member functions
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Iteration is just following the single linked list.
bool checkPoint() const
Iteration-logic: detect iteration end.
friend bool operator==(IterationState const &il, IterationState const &ir)
IterationState(N *p=nullptr)
void iterNext()
Iteration-logic: switch to next position.
Policy for LinkedElements: never create or destroy any elements, only allow to add already existing n...
void dispose(void *)
this policy doesn't take ownership and thus never discards anything
< allocation policies for the LinkedElements list container
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...