Add ForEach

This commit is contained in:
sha512sum 2024-03-01 16:50:49 +00:00
parent 5a1fced36d
commit f07d63bd67

View file

@ -267,6 +267,14 @@ inline constexpr auto Filter(Tuple&& tuple, auto&& f) {
); );
}; };
template <TupleLike Tuple>
inline constexpr auto ForEach(Tuple&& tuple, auto&& f) {
[&]<auto... Is>(std::index_sequence<Is...>){
(f(Get<Is>(std::forward<Tuple>(tuple))), ...);
}(std::make_index_sequence<kTupleSize<Tuple>>());
};
template <typename F, typename... Ts> template <typename F, typename... Ts>
struct Curryer { struct Curryer {
F f; F f;