Lumiera  0.pre.03
»edit your freedom«
_FunTraits< FUN, SRC > Struct Template Reference

#include "lib/iter-explorer.hpp"

Description

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
    FUNeither the signature, or something _"function-like"_ passed as functor to be bound
    SRCsource type to feed to the function to be adapted.
    Remarks
    Especially need to specify the source iterator type to apply when passing a generic lambda or template as FUN. Such a generic functor will be instantiated passing the type SRC& as argument. This instantiation may fail (and abort compilation), but when it succeeds, the result type Res can be inferred from the generic lambda.

Definition at line 402 of file iter-explorer.hpp.

Public Types

using Arg = typename _Fun< Sig >::Args::List::Head
 
using Res = typename _Fun< Sig >::Ret
 
using Sig = typename FunDetector< FUN >::Sig
 

Static Public Member Functions

static auto adaptFunctor (FUN &&rawFunctor)
 builder to create a nested/wrapping functor, suitably adapting the arguments
 

Classes

struct  ArgAdapter
 adapt to a functor, which accesses the source iterator or embedded "state core" More...
 
struct  ArgAdapter< IT, enable_if< __and_< is_base_of< IterSource< typename IT::value_type >, typename IT::Source >, is_base_of< IterSource< typename IT::value_type >, remove_reference_t< Arg > > > > >
 adapt to a functor collaborating with an IterSource based iterator pipeline More...
 
struct  ArgAdapter< IT, enable_if< __and_< is_convertible< typename IT::reference, Arg >, __not_< is_convertible< IT, Arg > > > > >
 adapt to a functor, which accepts the value type of the source sequence ("monadic" usage pattern) More...
 
struct  FunDetector
 handle all regular "function-like" entities More...
 
struct  FunDetector< F, disable_if< _Fun< F > > >
 handle a generic lambda, accepting a reference to the SRC iterator More...
 

Class Documentation

◆ lib::iter_explorer::_FunTraits::FunDetector

struct lib::iter_explorer::_FunTraits::FunDetector
Class Members
typedef typename _Fun< F >::Sig Sig
+ Collaboration diagram for _FunTraits< FUN, SRC >::FunDetector< F, SEL >:
+ Collaboration diagram for _FunTraits< FUN, SRC >:

The documentation for this struct was generated from the following file: