19#ifndef ESPRESSO_TUPLE_HPP
20#define ESPRESSO_TUPLE_HPP
36template <
class Tuple,
class F, std::size_t... I>
37constexpr void for_each_impl(F &&f, Tuple t, std::index_sequence<I...>) {
39 std::ignore = expand{0, ((void)(f(std::get<I>(t))), 0)...};
42template <
class F,
class Tuple>
43constexpr void for_each_impl(F, Tuple, std::index_sequence<>) {}
46template <
class F,
class Tuple>
void for_each(F &&f, Tuple &t) {
47 detail::for_each_impl<Tuple &>(
48 std::forward<F>(f), t,
49 std::make_index_sequence<std::tuple_size<Tuple>::value>{});
52template <
class F,
class Tuple>
void for_each(F &&f, Tuple &&t) {
53 detail::for_each_impl(
54 std::forward<F>(f), std::forward<Tuple>(t),
55 std::make_index_sequence<
56 std::tuple_size<std::remove_reference_t<Tuple>>::value>{});
void for_each(F &&f, Tuple &t)