30 constexpr
static size_t value = i;
31 constexpr
operator const size_t()
const {
return value; }
32 constexpr
operator size_t() {
return value; }
35 template<
size_t i,
size_t ibegin,
size_t iend,
typename Function>
36 constexpr
auto AuxFor(Function&& f)
38 if constexpr (i < iend) {
40 AuxFor<i + 1, ibegin, iend>(std::forward<Function>(f));
47 template<
size_t ibegin,
size_t iend,
typename Function>
48 constexpr
auto For(Function&& f)
50 detail::AuxFor<ibegin, ibegin, iend>(std::forward<Function>(f));
54 template<
size_t iend,
typename Function>
55 constexpr
auto For(Function&& f)
57 For<0, iend>(std::forward<Function>(f));
61 template<
typename Function>
62 constexpr
auto ForEach(Function
const& f) ->
void
67 template<
typename Function,
typename Arg,
typename... Args>
68 constexpr
auto ForEach(Function
const& f, Arg
const& arg, Args
const&... args) ->
void
The namespace containing all components of the Reaktoro library.
Definition: Algorithms.hpp:29
constexpr auto ForEach(Function const &f) -> void
Generate evaluation statements f(arg0); f(arg1); ...; f(argn); at compile time.
Definition: Meta.hpp:62
constexpr auto For(Function &&f)
Generate evaluation statements f(ibegin); f(ibegin + 1); ...; f(iend-1); at compile time.
Definition: Meta.hpp:48