3 #include "utilities/tuple_like.h" 5 #include <initializer_list> 10 template <
typename Func,
typename... Ts>
11 void for_each_params(Func&& func, Ts&&... ts) {
12 (void)std::initializer_list<int>{((void)func(std::forward<Ts>(ts)), 0)...};
15 template <
typename Func,
typename T,
size_t... Ix>
16 void for_each(Func&& func, T&& t, std::index_sequence<Ix...>) {
17 for_each_params(std::forward<Func>(func),
18 tuple_like_getter<Ix>(std::forward<T>(t))...);
21 template <
typename Func,
typename T>
22 void for_each(Func&& func, T&& t) {
23 for_each(std::forward<Func>(func),
25 std::make_index_sequence<
26 tuple_like_size_v<decay_const_ref_t<T>>>{});
29 template <
size_t Ix,
typename Func,
typename... Ts>
30 constexpr
auto apply_at_index(Func&& func, Ts&&... ts) {
31 return func(tuple_like_getter<Ix>(std::forward<Ts>(ts))...);
34 template <
size_t... Ix,
typename Func,
typename... Ts>
35 void for_each(Func&& func, std::index_sequence<Ix...>, Ts&&... ts) {
36 (void)std::initializer_list<int>{
37 ((void)apply_at_index<Ix>(std::forward<Func>(func),
38 std::forward<Ts>(ts)...),
42 template <
typename Func,
typename T,
typename... Ts>
43 void for_each(Func&& func, T&& t, Ts&&... ts) {
45 std::forward<Func>(func),
46 std::make_index_sequence<tuple_like_size_v<decay_const_ref_t<T>>>{},
48 std::forward<Ts>(ts)...);
Definition: allocator.h:6