template<class COR>
class lib::IterableDecorator< COR >
Decorator-Adapter to make a »*State Core*« iterable as Lumiera Forward Iterator.
This is a fundamental (and low-level) building block and works essentially the same as IterStateWrapper — with the significant difference however that the Core is mixed in by inheritance and thus its full interface remains publicly accessible. Another notable difference is that this adapter deliberately performs no sanity-checks. This can be dangerous, but allows to use this setup even in performance critical code.
- Warning
- be sure to understand the consequences of using ´core.yield()´ without checks; an iterator built this way must be checked before each use, unless it is guaranteed to be valid (by contextual knowledge). It might be a good idea to build some safety checks into the Core API functions instead, maybe even just as assertions, or to wrap the Core into CheckedCore for most usages.
- Template Parameters
-
COR | type of the »state core«. The resulting iterator will mix-in this type, and thus inherit properties like copy, move, compare, VTable, „POD-ness“. The COR must implement the following iteration control API:
checkPoint establishes if the given state element represents a valid state
- ´iterNext
evolves this state by one step (sideeffect) -# yield` realises the given state, exposing a result reference or value Furthermore, COR must be default-constructible in disabled state
|
- Note
- the resulting iterator will attempt to yield a reference to type T when possible; but when the wrapped
COR::yield()
produces a value, this is passed as such, moreover #operator-> becomes disabled then, to prevent taking the address of the (temporary) value!
- See also
- IterExplorer a pipeline builder framework on top of IterableDecorator
-
iter-explorer-test.hpp
-
iter-adaptor-test.cpp
Definition at line 680 of file iter-adapter.hpp.