3#include <initializer_list>
7#include <amdis/common/Index.hpp>
13 template <
class Functor,
class... Args>
14 constexpr void forVariadic(
Functor&& f, Args&&... args)
19 template <std::size_t... I,
class Tuple,
class Functor>
20 constexpr void forEach(std::index_sequence<I...>, Tuple&& tuple,
Functor&& f)
23 (f(get<I>(tuple)),...);
26 template <
class... T,
class Functor>
27 constexpr void forEach(std::tuple<T...>
const& tuple,
Functor&& f)
29 Ranges::forEach(std::make_index_sequence<
sizeof...(T)>{}, tuple, FWD(f));
32 template <
class... T,
class Functor>
33 constexpr void forEach(std::tuple<T...>& tuple,
Functor&& f)
35 Ranges::forEach(std::make_index_sequence<
sizeof...(T)>{}, tuple, FWD(f));
38 template <
class Range,
class Functor>
39 constexpr auto forEach(Range&& r,
Functor&& f)
40 -> std::void_t<
decltype((std::begin(r),std::end(r)))>
46 template <std::size_t I0 = 0, std::size_t... I,
class Functor>
47 constexpr void forIndices(std::index_sequence<I...>,
Functor&& f)
49 (f(index_t<I0+I>{}),...);
52 template <std::
size_t I0, std::
size_t I1,
class Functor>
53 constexpr void forIndices(index_t<I0>, index_t<I1>,
Functor&& f)
55 Ranges::forIndices<I0>(std::make_index_sequence<std::size_t(I1-I0)>{}, FWD(f));
58 template <std::
size_t N,
class Functor>
59 constexpr void forIndices(index_t<N>,
Functor&& f)
61 Ranges::forIndices(std::make_index_sequence<N>{}, FWD(f));
64 template <std::
size_t I0, std::
size_t I1,
class Functor>
65 constexpr void forIndices(
Functor&& f)
67 Ranges::forIndices<I0>(std::make_index_sequence<std::size_t(I1-I0)>{}, FWD(f));
70 template <std::
size_t N,
class Functor>
71 constexpr void forIndices(
Functor&& f)
73 Ranges::forIndices<0>(std::make_index_sequence<N>{}, FWD(f));
constexpr bool Functor
A Functor is a function F with signature Signature.
Definition: Concepts.hpp:133