- Test:
- Verify a mix-in to allow for lazy initialisation of complex infrastructure tied to a std::function; the intention is to have a »trap« hidden in the function itself to trigger on first use and perform the one-time initialisation, then finally lock the object at a fixed place.
- See also
- lazy-init.hpp
-
lib::RandomDraw
Definition at line 50 of file lazy-init-test.cpp.
◆ verify_trojanLambda()
void verify_trojanLambda |
( |
| ) |
|
|
inlineprivate |
- Test:
- verify construction of the »trap« front-end eventually to trigger initialisation
- this test does not involve any std::function, rather a heap-allocated copy of a λ
Definition at line 79 of file lazy-init-test.cpp.
◆ verify_inlineStorage()
void verify_inlineStorage |
( |
| ) |
|
|
inlineprivate |
◆ verify_TargetRelocation()
void verify_TargetRelocation |
( |
| ) |
|
|
inlineprivate |
- Test:
- verify navigating an object structure by applying known offsets consecutively from a starting point within an remote instance
Definition at line 185 of file lazy-init-test.cpp.
References lib::rani().
◆ verify_triggerMechanism()
void verify_triggerMechanism |
( |
| ) |
|
|
inlineprivate |
◆ verify_lazyInitialisation()
void verify_lazyInitialisation |
( |
| ) |
|
|
inlineprivate |
◆ verify_complexUsageWithCopy()
void verify_complexUsageWithCopy |
( |
| ) |
|
|
inlineprivate |
- Test:
- use an elaborately constructed example to cover more corner cases
- the function to manage and initialise lazily is a member of the derived class
- the initialisation routine adapts this function and links it with the current object location; thus, invoking this function on a copy would crash / corrupt memory.
- however, as long as initialisation has not been triggered, LazyDemo instances can be copied; they may even be assigned to existing instances, overwriting their state.
- a second given function will be chained behind the first one; this happens immediately if the first function was already invoked (and this initialised)
- but when however both functions are attached immediately, prior to invocation, then an elaborate chain of initialisers is setup behind the scenes and played back in definition order once lazy initialisation is triggered
- all the intermediary state is safe to copy and move and fork
Definition at line 386 of file lazy-init-test.cpp.
References VERIFY_ERROR.
The documentation for this class was generated from the following file: