mirror of
https://github.com/Neargye/magic_enum.git
synced 2026-01-10 23:44:29 +00:00
fix enums with underlying type bool
This commit is contained in:
parent
5003c436d6
commit
739942ab7d
2 changed files with 18 additions and 2 deletions
|
|
@ -54,6 +54,12 @@ enum number : unsigned long {
|
|||
#endif
|
||||
};
|
||||
|
||||
enum class Binary : bool
|
||||
{
|
||||
ONE,
|
||||
TWO
|
||||
};
|
||||
|
||||
namespace magic_enum::customize {
|
||||
template <>
|
||||
struct enum_range<number> {
|
||||
|
|
@ -737,3 +743,9 @@ TEST_CASE("cmp_less") {
|
|||
REQUIRE_FALSE(cmp_less(uint64_t_min, int32_t_min + offset_int64_t));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("bool") {
|
||||
REQUIRE(magic_enum::detail::reflected_min_v<Binary> == 0);
|
||||
REQUIRE(magic_enum::detail::reflected_max_v<Binary> == 1);
|
||||
REQUIRE(magic_enum::enum_values<Binary>() == std::array<Binary, 2>{{Binary::ONE, Binary::TWO}});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue