Add Find function with Metafunction and TypeList
This commit is contained in:
parent
fd9820aa22
commit
9c000bf6cd
1 changed files with 7 additions and 0 deletions
|
@ -64,6 +64,13 @@ consteval auto Find(TypeList<Ts...>) -> std::size_t {
|
||||||
return std::ranges::find(arr, true) - arr.begin();
|
return std::ranges::find(arr, true) - arr.begin();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <template <typename...> typename F, typename... Ts>
|
||||||
|
consteval auto Find(TypeList<Ts...>) -> std::size_t {
|
||||||
|
std::array<bool, sizeof...(Ts)> arr{F<Ts>::value...};
|
||||||
|
return std::ranges::find(arr, true) - arr.begin();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
consteval auto Reverse(TypeList<Ts...> list) {
|
consteval auto Reverse(TypeList<Ts...> list) {
|
||||||
return [&]<auto... Is>(std::index_sequence<Is...>) -> TypeList<decltype(Get<sizeof...(Ts) - Is - 1>(list))...> {
|
return [&]<auto... Is>(std::index_sequence<Is...>) -> TypeList<decltype(Get<sizeof...(Ts) - Is - 1>(list))...> {
|
||||||
|
|
Loading…
Reference in a new issue