Lumiera  0.pre.03
»edit your freedom«
LinkedElements_test Class Reference

Description

Test:
cover our custom single linked list template, in combination with Lumiera Forward Iterators and the usage of a custom allocator.

Definition at line 170 of file linked-elements-test.cpp.

Classes

struct  UseAllocationCluster
 Policy to use an Allocation cluster, but also to invoke all object destructors. More...
 

Private Member Functions

void iterating ()
 
void populate_by_iterator ()
 
void reverseList ()
 
virtual void run (Arg)
 
void simpleUsage ()
 
void verify_customAllocator ()
 
void verify_ExceptionSafety ()
 
void verify_nonOwnership ()
 
void verify_RAII_safety ()
 

Member Function Documentation

◆ verify_nonOwnership()

void verify_nonOwnership ( )
inlineprivate
Test:
add some node elements to the LinkedElements list but without taking ownership or performing any memory management.

This usage pattern is helpful when the node elements are already managed elsewhere.

Note
we're still (intrusively) using the next pointer within the node elements. This means, that still a given node can't be member in multiple lists.

Definition at line 355 of file linked-elements-test.cpp.

References lib::elements().

+ Here is the call graph for this function:

◆ verify_RAII_safety()

void verify_RAII_safety ( )
inlineprivate
Test:
to support using LinkedElements within RAII-style components, all the elements might be added in one sway, by pulling them from a Lumiera Forward Iterator.

In case this is done in the ctor, any exception while doing so will trigger cleanup of all elements (and then failure of the ctor altogether)

Definition at line 451 of file linked-elements-test.cpp.

◆ verify_customAllocator()

void verify_customAllocator ( )
inlineprivate
Test:
use custom allocator to create list elements
  • a dedicated policy allows to refer to an existing AllocationCluster and to arrange for all object destructors to be called when this cluster goes out of scope
  • a C++ standard allocator can also be used; as an example, again an AllocationCluster is used, but this time with the default adapter, which places objects tight and skips invocation of destructors; however, since the LinkedElements destructor is called, it walks all elements and delegates through std::allocator_traits, which will invoke the (virtual) base class destructors.

Definition at line 499 of file linked-elements-test.cpp.

References lib::elements(), LinkedElements< N, ALO >::emplace(), and AllocationCluster::numBytes().

+ Here is the call graph for this function:
+ Inheritance diagram for LinkedElements_test:
+ Collaboration diagram for LinkedElements_test:

The documentation for this class was generated from the following file: