Lumiera
0.pre.03
»edit your freedom«
|
The API is similar to a vector and allows for element access and iteration.
Definition at line 95 of file scoped-collection-test.cpp.
Classes | |
class | ManagerDemo |
class | Populator |
Functor to populate the Collection. More... | |
Private Member Functions | |
void | building_RAII_Style () |
void | building_StackStyle () |
void | iterating () |
virtual void | run (Arg) |
void | simpleUsage () |
void | verify_defaultPopulator () |
void | verify_embeddedCollection () |
void | verify_iteratorPopulator () |
void | verify_subclassPopulator () |
|
inlineprivate |
Any new elements will be created behind the already existing objects. In case of failure while creating an element, only this element gets destroyed, the rest of the container remains intact.
Definition at line 217 of file scoped-collection-test.cpp.
References ScopedCollection< I, siz >::emplace(), ScopedCollection< I, siz >::emplaceElement(), and lib::rani().
|
inlineprivate |
For this usage style, the collection is filled right away, during construction. If anything goes wrong, the whole collection is cleared and invalidated. Consequently there is no tangible "lifecycle" at the usage site. Either the collection is fully usable, or not at all. This requires the client to provide a functor (callback) to define the actual objects to be created within the ScopedCollection. These may as well be subclasses of the base type I, provided the general element storage size #siz was chosen sufficiently large to hold those subclass instances.
This test demonstrates the most elaborate usage pattern, where the client provides a full blown functor object #Populator, which even has embedded state. Generally speaking, anything exposing a suitable function call operator is acceptable.
Definition at line 297 of file scoped-collection-test.cpp.
References lib::rani().
|
inlineprivate |
The most obvious one being just to fill the collection with default constructed objects.
Definition at line 378 of file scoped-collection-test.cpp.
|
inlineprivate |
Here, our ManagerDemo instance owns a collection of numbers 50..1. They are created right while initialising the manager, and this initialisation is done by invoking a member function of the manager
Definition at line 446 of file scoped-collection-test.cpp.