3 #include "utilities/tuple_like.h" 7 template <
typename Callback,
typename T>
8 constexpr
auto foldl_params(Callback&&, T&& t) -> decltype(std::forward<T>(t)) {
9 return std::forward<T>(t);
12 template <
typename Callback,
typename Acc,
typename T,
typename... Ts>
13 constexpr
auto foldl_params(Callback&& callback, Acc&& acc, T&& t, Ts&&... ts) {
14 return foldl_params(std::forward<Callback>(callback),
15 callback(std::forward<Acc>(acc), std::forward<T>(t)),
16 std::forward<Ts>(ts)...);
19 template <
typename Callback,
typename T,
size_t... Ix>
20 constexpr
auto foldl(Callback&& callback,
22 std::index_sequence<Ix...>) {
23 return foldl_params(std::forward<Callback>(callback),
24 tuple_like_getter<Ix>(t)...);
27 template <
typename Callback,
typename T>
28 constexpr
auto foldl(Callback&& callback,
const T& t) {
29 return foldl(std::forward<Callback>(callback),
31 std::make_index_sequence<tuple_like_size_v<T>>{});
34 template <
typename Callback,
typename Init,
typename T,
size_t... Ix>
35 constexpr
auto foldl(Callback&& callback,
38 std::index_sequence<Ix...>) {
39 return foldl_params(std::forward<Callback>(callback),
41 tuple_like_getter<Ix>(t)...);
44 template <
typename Callback,
typename Init,
typename T>
45 constexpr
auto foldl(Callback&& callback,
const Init& init,
const T& t) {
46 return foldl(std::forward<Callback>(callback),
49 std::make_index_sequence<tuple_like_size_v<T>>{});
Definition: allocator.h:6