template<class FUN, typename SRC>
struct lib::iter_explorer::_FunTraits< FUN, SRC >
technical details of binding a functor into the IterExplorer. Notably, this happens when adapting an _"expansion functor"_ to allow expanding a given element from the TreeExploer (iterator) into a sequence of child elements. A quite similar situation arises when binding a transformation function to be mapped onto each result element.
The IterExplorer::expand() operation accepts various flavours of functors, and depending on the signature of such a functor, an appropriate adapter will be constructed here, allowing to write a generic Expander::expandChildren() operation. The following details are handled here:
- detect if the passed functor is generic, or a regular "function-like" entity.
- in case it is generic (generic lambda), we assume it actually accepts a reference to the source iterator type
SRC
. Thus we instantiate a templated functor with this argument type to find out about its result type (and this instantiation may fail)
- moreover, we try to determine, if an explicitly typed functor accepts a value as yielded by the embedded source iterator (this is the "monadic" usage pattern), or if it rather accepts the iterator or state core itself (the "opaque state manipulation" usage pattern).
- we generate a suitable argument accessor function and build the function composition of this accessor and the provided expansion functor.
- the resulting, combined functor is stored into a std::function, thereby abstracting from the actual adapting mechanism. This allows to combine different kinds of functors within the same processing step; and in addition, it allows the processing step to remain agnostic with respect to the adaptation and concrete type of the functor/lambda.
- Template Parameters
-
FUN | either the signature, or something _"function-like"_ passed as functor to be bound |
SRC | source type to feed to the function to be adapted. |
Definition at line 402 of file iter-explorer.hpp.