tlx

A FunctionChain is a chain of functors that can be folded to a single functors. More...
#include <function_chain.hpp>
Public Member Functions  
FunctionChain ()=default  
default constructor: empty functor chain. More...  
FunctionChain (const std::tuple< Functors...> &chain)  
Initialize the function chain with a given tuple of functions. More...  
template<typename Functor >  
auto  push (const Functor &functor) const 
Add a functor to the end of the chain. More...  
template<typename Functor >  
auto  operator& (const Functor &functor) const 
Add a functor to the end of the chain. More...  
auto  fold () const 
Build a single functor by "folding" the chain. More...  
template<typename... Input>  
auto  operator() (Input &&...value) const 
Directly call the folded function chain with a value. More...  
Static Public Attributes  
static constexpr bool  empty 
Is true if the FunctionChain is empty. More...  
static constexpr size_t  size 
Number of functors in the FunctionChain. More...  
Private Member Functions  
template<size_t... Is>  
auto  fold_chain (index_sequence< Is...>) const 
Auxilary function for "folding" the chain. More...  
Private Attributes  
std::tuple< Functors...>  chain_ 
Tuple of varying type that stores all functors. More...  
A FunctionChain is a chain of functors that can be folded to a single functors.
All functors within the chain receive a single input value, which is the result of all preceding functors in the chain.
The FunctionChain basically consists of a tuple that contains functors of varying types.
Input_  Input to first functor functor. 
Functors  Types of the different functors. 
Definition at line 87 of file function_chain.hpp.

default 
default constructor: empty functor chain.

inlineexplicit 
Initialize the function chain with a given tuple of functions.
chain  Tuple of functors. 
Definition at line 98 of file function_chain.hpp.

inline 
Build a single functor by "folding" the chain.
Folding means that the chain is processed from front to back.
Definition at line 135 of file function_chain.hpp.

inlineprivate 
Auxilary function for "folding" the chain.
This is needed to send all functors as parameters to the function that folds them together.
Definition at line 164 of file function_chain.hpp.

inline 
Add a functor to the end of the chain.
Alias for fold().
Functor  Type of the functors. 
functor  functor that should be added to the chain. 
Definition at line 127 of file function_chain.hpp.

inline 
Directly call the folded function chain with a value.
Definition at line 143 of file function_chain.hpp.

inline 
Add a functor to the end of the chain.
Functor  Type of the functors. 
functor  functor that should be added to the chain. 
Definition at line 111 of file function_chain.hpp.

private 
Tuple of varying type that stores all functors.
Definition at line 155 of file function_chain.hpp.

static 
Is true if the FunctionChain is empty.
Definition at line 148 of file function_chain.hpp.

static 
Number of functors in the FunctionChain.
Definition at line 151 of file function_chain.hpp.