1
0
Fork 0
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:
neargye 2021-06-24 11:47:06 +03:00
parent 5003c436d6
commit 739942ab7d
2 changed files with 18 additions and 2 deletions

View file

@ -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}});
}