template<class SRC, class RES>
class lib::iter_explorer::Expander< SRC, RES >
Decorator for IterExplorer adding the ability to "expand children". The expandChildren() operation is the key element of a depth-first evaluation: it consumes one element and performs a preconfigured expansion functor on that element to yield its "children". These are given in the form of another iterator, which needs to be compatible to the source iterator ("compatibility" boils down to both iterators yielding a compatible value type). Now, this sequence of children effectively replaces the expanded source element in the overall resulting sequence; which means, the nested sequence was flattened into the results. Since this expand() operation can again be invoked on the results, the implementation of such an evaluation requires a stack datastructure, so the nested iterator from each expand() invocation can be pushed to become the new active source for iteration. Thus the primary purpose of this Expander (decorator) is to integrate those "nested child iterators" seamlessly into the overall iteration process; once a child iterator is exhausted, it will be popped and iteration continues with the previous child iterator or finally with the source iterator wrapped by this decorator. The source pipeline is only pulled once the expanded children are exhausted.
- Template Parameters
-
SRC | the wrapped source iterator, typically a IterExplorer or nested decorator. |
FUN | the concrete type of the functor passed. Will be dissected to find the signature |
- Note
- the return type of #yield depends both on the return type produced from the original sequence and the return type of the sequence established through the expand functor. An attempt is made to reconcile these and this attempt may fail (at compile time). The reason is, any further processing downstream can not tell if data was produced by the original sequence of the expansion sequence. Notably, if one of these two delivers results by-value, then the Expander will always deliver all results by-value, because it would not be possible to expose a reference to some value that was just delivered temporarily from a source iterator.
Definition at line 554 of file iter-explorer.hpp.