mirror of
https://github.com/aantron/better-enums.git
synced 2025-12-06 08:46:42 +08:00
Removed _from_index_loop and moved its functionality to _from_index_nothrow
This commit is contained in:
parent
f044492ae8
commit
8e2bc1d876
16
enum.h
16
enum.h
@ -675,8 +675,6 @@ class Enum { \
|
||||
\
|
||||
BETTER_ENUMS_CONSTEXPR_ static _optional_index \
|
||||
_from_value_loop(_integral value, std::size_t index = 0); \
|
||||
BETTER_ENUMS_CONSTEXPR_ static _optional \
|
||||
_from_index_loop(std::size_t index); \
|
||||
BETTER_ENUMS_CONSTEXPR_ static _optional_index \
|
||||
_from_string_loop(const char *name, std::size_t index = 0); \
|
||||
BETTER_ENUMS_CONSTEXPR_ static _optional_index \
|
||||
@ -717,15 +715,6 @@ Enum::_from_value_loop(Enum::_integral value, std::size_t index) \
|
||||
_from_value_loop(value, index + 1); \
|
||||
} \
|
||||
\
|
||||
BETTER_ENUMS_CONSTEXPR_ inline Enum::_optional \
|
||||
Enum::_from_index_loop(std::size_t index) \
|
||||
{ \
|
||||
return \
|
||||
index >= _size() ? \
|
||||
_optional() : \
|
||||
_optional(BETTER_ENUMS_NS(Enum)::_value_array[index]); \
|
||||
} \
|
||||
\
|
||||
BETTER_ENUMS_CONSTEXPR_ inline Enum::_optional_index \
|
||||
Enum::_from_string_loop(const char *name, std::size_t index) \
|
||||
{ \
|
||||
@ -768,7 +757,10 @@ Enum::_from_index_unchecked(std::size_t index) \
|
||||
BETTER_ENUMS_CONSTEXPR_ inline Enum::_optional \
|
||||
Enum::_from_index_nothrow(std::size_t index) \
|
||||
{ \
|
||||
return _from_index_loop(index); \
|
||||
return \
|
||||
index >= _size() ? \
|
||||
_optional() : \
|
||||
_optional(BETTER_ENUMS_NS(Enum)::_value_array[index]); \
|
||||
} \
|
||||
\
|
||||
BETTER_ENUMS_IF_EXCEPTIONS( \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user