21 #ifndef RFFGEN_UTIL_CHAINER_HH
22 #define RFFGEN_UTIL_CHAINER_HH
24 #include <type_traits>
26 #include "../MathematicalOperations/chain.hh"
33 template <
class Function>
36 decltype(
auto) operator()() const noexcept
38 return static_cast<const Function*
>(
this)->d0();
41 template <
class Arg ,
42 class = std::enable_if_t< !std::is_base_of<Base,Arg>::value > >
43 decltype(
auto) operator()(const Arg& x)
45 static_cast<Function*
>(
this)->update(x);
46 return static_cast<const Function*
>(
this)->d0();
49 template <
class OtherFunction ,
50 class = std::enable_if_t< std::is_base_of<Base,OtherFunction>::value > >
51 auto operator()(
const OtherFunction& g)
53 return MathematicalOperations::Chain<Function,OtherFunction>(*
static_cast<const Function*
>(
this),g);
60 #endif // RFFGEN_UTIL_CHAINER_HH