Lumiera
0.pre.03
»edit your freedom«
|
#include "lib/meta/function-closure.hpp"
Partial function application Takes a function and a value tuple, using the latter to close function arguments either from the front (left) or aligned to the end of the function argument list.
Result is a "reduced" function, expecting only the remaining "un-closed" arguments at invocation.
SIG | signature of the function to be closed, either as function reference type or std::function object |
VAL | type sequence describing the tuple of values used for closing arguments |
std::bind
(which can be confusing) Definition at line 567 of file function-closure.hpp.
Public Types | |
typedef function< typename BuildFunType< Ret, ArgsL >::Sig > | LeftReducedFunc |
typedef function< typename BuildFunType< Ret, ArgsR >::Sig > | RightReducedFunc |
Static Public Member Functions | |
static RightReducedFunc | bindBack (SIG const &f, Tuple< ValTypes > const &arg) |
do a partial function application, closing the last argumentsf(a,b,c)->res + (b,c) yields f(a)->res More... | |
static LeftReducedFunc | bindFront (SIG const &f, Tuple< ValTypes > const &arg) |
do a partial function application, closing the first argumentsf(a,b,c)->res + (a,b) yields f(c)->res More... | |
Private Types | |
enum | { ARG_CNT = count<ArgsList>::value, VAL_CNT = count<ValList> ::value, ROFFSET = (VAL_CNT < ARG_CNT)? ARG_CNT-VAL_CNT : 0 } |
typedef _Fun< SIG >::Args | Args |
typedef Types< LeftReduced >::Seq | ArgsL |
typedef Args::List | ArgsList |
typedef Types< RightReduced >::Seq | ArgsR |
using | BuildL = TupleConstructor< LeftReplacedTypes, IdxSelectorL > |
using | BuildR = TupleConstructor< RightReplacedTypes, IdxSelectorR > |
template<class SRC , class TAR , size_t i> | |
using | IdxSelectorL = typename PartiallyInitTuple< SRC, TAR, 0 >::template IndexMapper< i > |
template<class SRC , class TAR , size_t i> | |
using | IdxSelectorR = typename PartiallyInitTuple< SRC, TAR, ROFFSET >::template IndexMapper< i > |
typedef func::PlaceholderTuple< RightReduced >::List | LeadingPlaceholders |
typedef Splice< ArgsList, ValList >::Back | LeftReduced |
typedef Splice< ArgsList, TrailingPlaceholders, VAL_CNT >::List | LeftReplaced |
using | LeftReplacedArgs = Tuple< LeftReplacedTypes > |
Tuple to hold all argument values, starting from left. More... | |
typedef Types< LeftReplaced >::Seq | LeftReplacedTypes |
typedef _Fun< SIG >::Ret | Ret |
typedef Splice< ArgsList, ValList, ROFFSET >::Front | RightReduced |
typedef Splice< ArgsList, LeadingPlaceholders, 0 >::List | RightReplaced |
using | RightReplacedArgs = Tuple< RightReplacedTypes > |
Tuple to hold all argument values, aligned to the end of the function argument list. More... | |
typedef Types< RightReplaced >::Seq | RightReplacedTypes |
typedef func::PlaceholderTuple< LeftReduced >::List | TrailingPlaceholders |
typedef VAL::List | ValList |
typedef Types< ValList >::Seq | ValTypes |
|
private |
Tuple to hold all argument values, starting from left.
Any remaining positions behind the substitute values are occupied by binding placeholders
Definition at line 617 of file function-closure.hpp.
|
private |
Tuple to hold all argument values, aligned to the end of the function argument list.
Any remaining positions before the substitute values are occupied by binding placeholders
Definition at line 621 of file function-closure.hpp.
do a partial function application, closing the first arguments
f(a,b,c)->res + (a,b)
yields f(c)->res
f | function, function pointer or functor |
arg | value tuple, used to close function arguments starting from left |
Definition at line 638 of file function-closure.hpp.
do a partial function application, closing the last arguments
f(a,b,c)->res + (b,c)
yields f(a)->res
f | function, function pointer or functor |
arg | value tuple, used to close function arguments starting from right |
Definition at line 653 of file function-closure.hpp.