6#include <amdis/common/Apply.hpp>
7#include <amdis/common/Concepts.hpp>
8#include <amdis/common/Logical.hpp>
9#include <amdis/operations/Basic.hpp>
28 template <
class F,
class... Gs>
31 template <
class F_,
class... Gs_,
33 constexpr Composer(F_&& f, Gs_&&... gs)
38 template <
class... Ts>
39 constexpr auto operator()(Ts
const&... args)
const
41 auto eval = [&](
auto const& g) {
return g(args...); };
42 return Ranges::apply([&,
this](
auto const&... gs) {
return f_(eval(gs)...); }, gs_);
46 std::tuple<Gs...> gs_;
50 template <
class F,
class... Gs>
55 template <
class F_,
class... Gs_>
56 static constexpr type build(F_&& f, Gs_&&... gs)
58 return type{FWD(f), FWD(gs)...};
64 template <
class F,
class... Gs>
65 constexpr auto compose(F&& f, Gs&&... gs)
67 return ComposerBuilder<TYPEOF(f), TYPEOF(gs)...>::build(FWD(f), FWD(gs)...);
71 template <
class F,
class... Gs,
class... Int,
72 REQUIRES(Concepts::HasFunctorOrder<F,
sizeof...(Gs)>
73 && (Concepts::HasFunctorOrder<Gs,
sizeof...(Int)> &&...))>
74 int order(Composer<F,Gs...>
const& c, Int... degrees)
76 auto deg = [&](
auto const& g) {
return order(g,
int(degrees)...); };
77 return Ranges::apply([&](
auto const&... gs) {
return order(c.f_, deg(gs)...); }, c.gs_);
82 template <
int J,
class F,
class... Gs>
83 auto partial(Composer<F,Gs...>
const& c, index_t<J> _j);
96 static constexpr F build(F_&& f)
constexpr bool Similar
Types are the same, up to decay of qualifiers.
Definition: Concepts.hpp:107
Definition: Composer.hpp:52
Composition of Functors.
Definition: Composer.hpp:30
(Unary-)Functor representing the identity
Definition: Basic.hpp:65
A variadic type list.
Definition: TypeTraits.hpp:146