7#include <amdis/common/Index.hpp>
8#include <amdis/common/StaticSize.hpp>
9#include <amdis/common/TypeTraits.hpp>
17 template <
class Functor,
class Tuple, std::size_t... I>
18 constexpr decltype(
auto) applyImpl(
Functor&& f, Tuple&& t, std::index_sequence<I...>)
21 return f(get<I>(FWD(t))...);
24 template <
class Functor, std::size_t I0, std::size_t... I>
25 constexpr decltype(
auto) applyIndicesImpl(
Functor&& f, index_t<I0>, std::index_sequence<I...>)
27 return f(index_t<I0+I>{}...);
31 template <
class F,
class Tuple>
32 constexpr decltype(
auto) apply(F&& f, Tuple&& t)
34 return Impl_::applyImpl(FWD(f), FWD(t),
35 std::make_index_sequence<static_size_v<Tuple>>{});
38 template <
class F, std::size_t... I>
39 constexpr decltype(
auto) apply(F&& f, std::index_sequence<I...> seq)
41 return Impl_::applyIndicesImpl(FWD(f), index_t<0>{}, seq);
44 template <
class Functor,
class... Args>
45 constexpr decltype(
auto) applyVariadic(
Functor&& f, Args&&... args)
47 return Impl_::applyImpl(FWD(f), std::forward_as_tuple(args...),
48 std::make_index_sequence<
sizeof...(Args)>{});
51 template <std::
size_t N,
class Functor>
52 constexpr decltype(
auto) applyIndices(
Functor&& f)
54 return Impl_::applyIndicesImpl(FWD(f), index_t<0>{},
55 std::make_index_sequence<N>{});
58 template <std::
size_t I0, std::
size_t I1,
class Functor>
59 constexpr decltype(
auto) applyIndices(
Functor&& f)
61 return Impl_::applyIndicesImpl(FWD(f), index_t<I0>{},
62 std::make_index_sequence<I1-I0>{});
65 template <
class Functor, std::
size_t N>
66 constexpr decltype(
auto) applyIndices(
Functor&& f, index_t<N>)
68 return Impl_::applyIndicesImpl(FWD(f), index_t<0>{},
69 std::make_index_sequence<N>{});
72 template <
class Functor, std::
size_t I0, std::
size_t I1>
73 constexpr decltype(
auto) applyIndices(
Functor&& f, index_t<I0>, index_t<I1>)
75 return Impl_::applyIndicesImpl(FWD(f), index_t<I0>{},
76 std::make_index_sequence<I1-I0>{});
constexpr bool Functor
A Functor is a function F with signature Signature.
Definition: Concepts.hpp:133