mirror of
https://github.com/Neargye/magic_enum.git
synced 2026-01-08 23:24:20 +00:00
fix namespace
This commit is contained in:
parent
aaf57737d5
commit
083298a045
5 changed files with 9 additions and 9 deletions
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
* If an enum is declared as a flag enum, its zero value will not be reflected.
|
||||
|
||||
* Or, for enum types that are deeply nested in classes and/or namespaces, declare a function called `adl_magic_enum_define_range(my_enum_type)` in the same namespace as `my_enum_type`, which magic_enum will find by ADL (because the function is in the same class/namespace as `my_enum_type`), and whose return type is a `magic_enum::customize::adl_info`.
|
||||
* Or, for enum types that are deeply nested in classes and/or namespaces, declare a function called `magic_enum_define_range_adl(my_enum_type)` in the same namespace as `my_enum_type`, which magic_enum will find by ADL (because the function is in the same class/namespace as `my_enum_type`), and whose return type is a `magic_enum::customize::adl_info`.
|
||||
|
||||
```cpp
|
||||
namespace Deeply::Nested::Namespace {
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
// - magic_enum will find this function by ADL
|
||||
// - uses builder pattern
|
||||
// - use auto to not have to name the type yourself
|
||||
auto adl_magic_enum_define_range(my_enum_type)
|
||||
auto magic_enum_define_range_adl(my_enum_type)
|
||||
{
|
||||
return magic_enum::customize::adl_info()
|
||||
.minmax<10,10>() // the min max search range
|
||||
|
|
|
|||
|
|
@ -570,7 +570,7 @@ constexpr bool enum_flags_contains(string_view value, BinaryPredicate p) noexcep
|
|||
magic_enum::enum_flags_test_any(Left|Down|Right, Down|Right); // -> "true"
|
||||
```
|
||||
|
||||
* Or, for enum types that are deeply nested in classes and/or namespaces, declare a function called `adl_magic_enum_define_range(my_enum_type)` in the same namespace as `my_enum_type`, which magic_enum will find by ADL (because the function is in the same class/namespace as `my_enum_type`), and whose return type is a `magic_enum::customize::adl_info`.
|
||||
* Or, for enum types that are deeply nested in classes and/or namespaces, declare a function called `magic_enum_define_range_adl(my_enum_type)` in the same namespace as `my_enum_type`, which magic_enum will find by ADL (because the function is in the same class/namespace as `my_enum_type`), and whose return type is a `magic_enum::customize::adl_info`.
|
||||
|
||||
```cpp
|
||||
namespace Deeply::Nested::Namespace {
|
||||
|
|
@ -579,7 +579,7 @@ namespace Deeply::Nested::Namespace {
|
|||
// - magic_enum will find this function by ADL
|
||||
// - uses builder pattern
|
||||
// - use auto to not have to name the type yourself
|
||||
auto adl_magic_enum_define_range(my_enum_type)
|
||||
auto magic_enum_define_range_adl(my_enum_type)
|
||||
{
|
||||
return magic_enum::customize::adl_info()
|
||||
.minmax<10,10>() // the min max search range
|
||||
|
|
|
|||
|
|
@ -218,8 +218,8 @@ struct enum_range {
|
|||
};
|
||||
|
||||
template <typename E>
|
||||
struct enum_range<E, decltype(void(adl_magic_enum_define_range(E{}))) >
|
||||
: decltype(adl_magic_enum_define_range(E{})) {};
|
||||
struct enum_range<E, decltype(void(magic_enum_define_range_adl(E{}))) >
|
||||
: decltype(magic_enum_define_range_adl(E{})) {};
|
||||
|
||||
static_assert(MAGIC_ENUM_RANGE_MAX > MAGIC_ENUM_RANGE_MIN, "MAGIC_ENUM_RANGE_MAX must be greater than MAGIC_ENUM_RANGE_MIN.");
|
||||
|
||||
|
|
|
|||
|
|
@ -103,13 +103,13 @@ namespace We::Need::To::Go::Deeper {
|
|||
enum class Dimension : short { Overworld = 1000, Nether, TheEnd = Overworld + 128 };
|
||||
enum class Flaggy : std::uint64_t { Flag0 = 1 << 0, Flag32 = std::uint64_t(1) << 32 };
|
||||
|
||||
auto adl_magic_enum_define_range(Dimension)
|
||||
auto magic_enum_define_range_adl(Dimension)
|
||||
{
|
||||
return magic_enum::customize::adl_info().minmax<1000,1000+128>();
|
||||
}
|
||||
|
||||
// not defined!
|
||||
auto adl_magic_enum_define_range(Flaggy)
|
||||
auto magic_enum_define_range_adl(Flaggy)
|
||||
{
|
||||
return magic_enum::customize::adl_info().flag<true>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace Namespace {
|
|||
three = 1 << 3,
|
||||
many = 1 << 30,
|
||||
};
|
||||
auto adl_magic_enum_define_range(Numbers)
|
||||
auto magic_enum_define_range_adl(Numbers)
|
||||
{
|
||||
return magic_enum::customize::adl_info().flag<true>();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue