Lumiera
0.pre.03
»edit your freedom«
|
#include "lib/linked-elements.hpp"
Intrusive single linked list, possibly taking ownership of node elements.
Additional elements can be pushed (prepended) to the list; element access is per index number (slow) or through an Lumiera Forward Iterator traversing the linked list. There is no support for changing the list contents aside of discarding any element in the list.
The allocation and ownership related behaviour is controlled by a policy class provided as template parameter. When this policy supports creation of new elements, these might be created and prepended in one step.
sizeof(LinkedElements) == sizeof(N*)
Definition at line 158 of file linked-elements.hpp.
Public Types | |
using | const_iterator = IterStateWrapper< IterationState, const N & > |
using | iterator = IterStateWrapper< IterationState, N & > |
Public Member Functions | |
LinkedElements (LinkedElements const &)=default | |
LinkedElements (LinkedElements &&rr) | |
LinkedElements (typename ALO::CustomAllocator allo) | |
template<class IT > | |
LinkedElements (IT &&elements) | |
creating a LinkedElements list in RAII-style: More... | |
iterator | begin () |
const_iterator | begin () const |
void | clear () noexcept |
template<class TY = N, typename... ARGS> | |
TY & | emplace (ARGS &&...args) |
prepend object of type TY, forwarding ctor args | |
bool | empty () const |
iterator | end () |
const_iterator | end () const |
N & | operator[] (size_t index) const |
template<typename TY > | |
TY & | push (TY &elm) noexcept |
accept the given element and prepend it to the list of elements; depending on the allocation policy, this might imply taking ownership More... | |
template<class IT > | |
void | pushAll (IT elements) |
convenience shortcut to add all the elements yielded by the given Lumiera Forward Iterator More... | |
LinkedElements & | reverse () |
Mutate the complete list to change the order of elements. More... | |
size_t | size () const |
N & | top () const |
Classes | |
struct | IterationState |
Iteration is just following the single linked list. More... | |
Private Attributes | |
N * | head_ |
|
inlineexplicit |
allo | custom allocator or memory manager to be used by the policy for creating and discarding of node elements |
Definition at line 187 of file linked-elements.hpp.
|
inline |
creating a LinkedElements list in RAII-style:
elements | iterator to provide all the elements to be pushed into this newly created collection |
Definition at line 200 of file linked-elements.hpp.
|
inlinenoexcept |
Definition at line 218 of file linked-elements.hpp.
|
inline |
convenience shortcut to add all the elements yielded by the given Lumiera Forward Iterator
Definition at line 238 of file linked-elements.hpp.
|
inlinenoexcept |
accept the given element and prepend it to the list of elements; depending on the allocation policy, this might imply taking ownership
Definition at line 253 of file linked-elements.hpp.
|
inline |
Mutate the complete list to change the order of elements.
Definition at line 279 of file linked-elements.hpp.
|
inline |
Definition at line 319 of file linked-elements.hpp.
|
inline |
Definition at line 328 of file linked-elements.hpp.