template<class SRC, class RES>
class lib::iter_explorer::Transformer< SRC, RES >
Decorator for IterExplorer to map a transformation function on all results. The transformation function is invoked on demand, and only once per item to be treated, storing the treated result into an universal value holder buffer. The given functor is adapted in a similar way as the "expand functor", so to detect and convert the expected input on invocation.
- Note
- the result-type of the #yield() function must be
reference
, even when the TransformFunctor produces a value; otherwise we can not provide a safe operator->
on any iterator downstream. This is also the reason why the ItemWrapper is necessary, precisely because we want to support functions producing a value; it provides a safe location for this value to persist.
- Warning
- handling a transformer function which exposes references can be dangerous. For this reason, Transformer attempts to »dis-engage« on each copy / assignment, in order to provoke a re-invocation of the transformer function, which hopefully picks up references to the copied / moved / swapped location. Be careful though!
Definition at line 782 of file iter-explorer.hpp.