Add Unpack
This commit is contained in:
parent
2c327741b1
commit
b0e51d868f
1 changed files with 8 additions and 0 deletions
|
@ -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>
|
template <TupleLike Tuple>
|
||||||
inline constexpr auto Reverse(Tuple&& tuple) {
|
inline constexpr auto Reverse(Tuple&& tuple) {
|
||||||
return [&]<auto... Is>(std::index_sequence<Is...>) {
|
return [&]<auto... Is>(std::index_sequence<Is...>) {
|
||||||
|
|
Loading…
Reference in a new issue