mirror of
https://github.com/Neargye/magic_enum.git
synced 2026-01-10 23:44:29 +00:00
clean-up
This commit is contained in:
parent
41c916432b
commit
b19a54c272
1 changed files with 7 additions and 5 deletions
|
|
@ -225,6 +225,7 @@ constexpr std::size_t find(string_view str, char c) noexcept {
|
|||
#else
|
||||
constexpr bool workaround = false;
|
||||
#endif
|
||||
|
||||
if constexpr (workaround) {
|
||||
for (std::size_t i = 0; i < str.size(); ++i) {
|
||||
if (str[i] == c) {
|
||||
|
|
@ -252,12 +253,9 @@ constexpr bool cmp_equal(string_view lhs, string_view rhs, BinaryPredicate&& p)
|
|||
#else
|
||||
constexpr bool workaround = false;
|
||||
#endif
|
||||
constexpr bool default_predicate = std::is_same_v<std::decay_t<BinaryPredicate>, char_equal_to>;
|
||||
constexpr bool custom_predicate = std::negation_v<std::is_same<std::decay_t<BinaryPredicate>, char_equal_to>>;
|
||||
|
||||
if constexpr (default_predicate && !workaround) {
|
||||
static_cast<void>(p);
|
||||
return lhs == rhs;
|
||||
} else {
|
||||
if constexpr (custom_predicate || workaround) {
|
||||
if (lhs.size() != rhs.size()) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -270,6 +268,10 @@ constexpr bool cmp_equal(string_view lhs, string_view rhs, BinaryPredicate&& p)
|
|||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
static_cast<void>(p);
|
||||
|
||||
return lhs == rhs;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue