mirror of
https://github.com/RPCSX/rpcsx.git
synced 2024-11-23 03:19:47 +00:00
refl: accept enums without valid 0 members
This commit is contained in:
parent
b6556e83ee
commit
fd44e4f960
@ -133,18 +133,17 @@ namespace detail {
|
|||||||
template <typename EnumT, std::size_t N = 0>
|
template <typename EnumT, std::size_t N = 0>
|
||||||
requires std::is_enum_v<EnumT>
|
requires std::is_enum_v<EnumT>
|
||||||
constexpr auto calcFieldCount() {
|
constexpr auto calcFieldCount() {
|
||||||
|
if constexpr (requires { EnumT::Count; }) {
|
||||||
if constexpr (!requires { getNameOf<EnumT(N)>()[0]; }) {
|
return static_cast<std::size_t>(EnumT::Count);
|
||||||
|
} else if constexpr (requires { EnumT::_count; }) {
|
||||||
|
return static_cast<std::size_t>(EnumT::_count);
|
||||||
|
} else if constexpr (requires { EnumT::count; }) {
|
||||||
|
return static_cast<std::size_t>(EnumT::count);
|
||||||
|
} else if constexpr (!requires { getNameOf<EnumT(N)>()[0]; }) {
|
||||||
return N;
|
return N;
|
||||||
} else {
|
} else {
|
||||||
constexpr auto c = getNameOf<EnumT(N)>()[0];
|
constexpr auto c = getNameOf<EnumT(N)>()[0];
|
||||||
if constexpr (requires { EnumT::Count; }) {
|
if constexpr (!requires { getNameOf<EnumT(N)>()[0]; }) {
|
||||||
return static_cast<std::size_t>(EnumT::Count);
|
|
||||||
} else if constexpr (requires { EnumT::_count; }) {
|
|
||||||
return static_cast<std::size_t>(EnumT::_count);
|
|
||||||
} else if constexpr (requires { EnumT::count; }) {
|
|
||||||
return static_cast<std::size_t>(EnumT::count);
|
|
||||||
} else if constexpr (!requires { getNameOf<EnumT(N)>()[0]; }) {
|
|
||||||
return N;
|
return N;
|
||||||
} else if constexpr (c >= '0' && c <= '9') {
|
} else if constexpr (c >= '0' && c <= '9') {
|
||||||
return N;
|
return N;
|
||||||
|
Loading…
Reference in New Issue
Block a user