Add PackConstexprWrapper
This commit is contained in:
parent
a767c7637a
commit
024dbaf525
1 changed files with 15 additions and 3 deletions
|
@ -20,6 +20,10 @@ struct Wrapper {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <auto Value>
|
||||||
|
inline constexpr Wrapper<Value> kWrapper;
|
||||||
|
|
||||||
|
|
||||||
template <ConstexprString string, typename T = std::size_t>
|
template <ConstexprString string, typename T = std::size_t>
|
||||||
consteval auto ParseNumber() -> T {
|
consteval auto ParseNumber() -> T {
|
||||||
T response{};
|
T response{};
|
||||||
|
@ -343,9 +347,17 @@ inline constexpr auto Map(F&& f, TypeList<R> result = {}) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <auto Tuple>
|
||||||
|
consteval auto PackConstexprWrapper() {
|
||||||
|
return [&]<std::size_t... Is>(std::index_sequence<Is...>) {
|
||||||
|
return MakeTuple<decltype(Tuple)>(kWrapper<Get<Is>(Tuple)>...);
|
||||||
|
}(std::make_index_sequence<kTupleSize<decltype(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 [&]<std::size_t... Is>(std::index_sequence<Is...>) {
|
||||||
return MakeTuple<Tuple>(Get<kTupleSize<Tuple> - Is - 1>(std::forward<Tuple>(tuple))...);
|
return MakeTuple<Tuple>(Get<kTupleSize<Tuple> - Is - 1>(std::forward<Tuple>(tuple))...);
|
||||||
}(std::make_index_sequence<kTupleSize<Tuple>>());
|
}(std::make_index_sequence<kTupleSize<Tuple>>());
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue