53 #ifndef LIB_LINKED_ELEMENTS_H 54 #define LIB_LINKED_ELEMENTS_H 70 using LERR_(INDEX_BOUNDS);
74 namespace linked_elements {
90 using CustomAllocator = ALO;
112 typedef void* CustomAllocator;
123 template<
class TY,
typename...ARGS>
127 static_assert (
"NoOwnership allocation strategy can not allocate elements");
204 pushAll (std::forward<IT> (
elements));
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;
300 operator[] (
size_t index)
const 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;
392 return il.node == ir.node;
416 return reinterpret_cast<Linked const&
>(anchor);
LinkedElements & reverse()
Mutate the complete list to change the order of elements.
IterQueue< T > elements(T const &elm)
convenience free function to build an iterable sequence
TY & emplace(ARGS &&...args)
prepend object of type TY, forwarding ctor args
Iteration is just following the single linked list.
< Concepts and Adaptors for custom memory management
TY * create(ARGS &&...args)
create new element using the embedded allocator
void pushAll(IT elements)
convenience shortcut to add all the elements yielded by the given Lumiera Forward Iterator ...
#define ERROR_LOG_AND_IGNORE(_FLAG_, _OP_DESCR_)
convenience shortcut for a sequence of catch blocks just logging and consuming an error...
Intrusive single linked list, possibly taking ownership of node elements.
Helper template(s) for creating Lumiera Forward Iterators.
Types marked with this mix-in may be moved but not copied.
A front-end/concept to allow access to custom memory management.
< allocation policies for the LinkedElements list container
LinkedElements(IT &&elements)
creating a LinkedElements list in RAII-style:
Implementation namespace for support and library code.
Derived specific exceptions within Lumiera's exception hierarchy.
void iterNext()
Iteration-logic: switch to next position.
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Another Lumiera Forward Iterator building block, based on incorporating a state type as »*State Core*...
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
void dispose(void *)
this policy doesn't take ownership and thus never discards anything
Lumiera error handling (C++ interface).
auto & asLinkedElements(N *const &anchor)
transiently reinterpret an element pointer as const LinkedElements, allowing to count, iterate or subscript a chain of elements
TY & push(TY &elm) noexcept
accept the given element and prepend it to the list of elements; depending on the allocation policy...
bool checkPoint() const
Iteration-logic: detect iteration end.
LinkedElements(typename ALO::CustomAllocator allo)
Policy for LinkedElements: never create or destroy any elements, only allow to add already existing n...