Functions | |
| template<typename F > | |
| impl::adapt< F > | rangeless::fn::adapt (F fn) |
| Create a custom processing-stage function-object. More... | |
| template<typename F > | |
| impl::transform< F > | rangeless::fn::transform (F map_fn) |
Create a seq yielding results of applying the transform functions to input-elements. More... | |
| impl::adapt<F> rangeless::fn::adapt | ( | F | fn | ) |
Create a custom processing-stage function-object.
This is somewhat similar to fn::transform, except the correspondence between inputs and outputs is not necessarily 1:1, and instead of taking a single element to transform we take a nullary generator callable gen and use it to fetch however many input elements we need to generate the next output element.
NB: If bool(gen)==false, the next invocation of gen() shall throw fn::end_seq::exception signaling end-of-inputs.
A more realistic example: suppose you have a pipeline transforming inputs to outputs in parallel, and you want to compress the output, but the outputs are small and compressing them individually would be ineffective, and you want to serialize the incoming results into a buffer of some minimum size, e.g. 100kb, before passing it to the compressing stage.
| impl::transform<F> rangeless::fn::transform | ( | F | map_fn | ) |
Create a seq yielding results of applying the transform functions to input-elements.
Returns a unary function-object, which will capture the arg by value and return an adapted seq<...> which will yield results of invoking map_fn on the elements (passed by value) of arg. See fn::where for an example.