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.
Definition at line 224 of file linked-elements.hpp.
Public Types | |
using | const_iterator = IterStateWrapper< const N, IterationState > |
using | iterator = IterStateWrapper< N, IterationState > |
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 () |
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) |
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 253 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 265 of file linked-elements.hpp.
|
inline |
Definition at line 283 of file linked-elements.hpp.
|
inline |
convenience shortcut to add all the elements yielded by the given Lumiera Forward Iterator
Definition at line 303 of file linked-elements.hpp.
|
inline |
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 318 of file linked-elements.hpp.
|
inline |
Mutate the complete list to change the order of elements.
Definition at line 350 of file linked-elements.hpp.
|
inline |
Definition at line 390 of file linked-elements.hpp.
|
inline |
Definition at line 399 of file linked-elements.hpp.