Add Unpack

This commit is contained in:
sha512sum 2024-03-26 09:12:44 +00:00
parent 2c327741b1
commit b0e51d868f

View file

@ -175,6 +175,14 @@ inline constexpr auto Map(Tuple&& tuple, F&& f, TypeList<R> result = {}) {
};
template <TupleLike Tuple, typename F>
inline constexpr auto Unpack(Tuple&& tuple, F&& f) -> decltype(auto) {
return [&]<std::size_t... Is>(std::index_sequence<Is...>) -> decltype(auto) {
return f(Get<Is>(std::forward<Tuple>(tuple))...);
}(std::make_index_sequence<kTupleSize<Tuple>>());
};
template <TupleLike Tuple>
inline constexpr auto Reverse(Tuple&& tuple) {
return [&]<auto... Is>(std::index_sequence<Is...>) {