diff --git a/doc/limitations.md b/doc/limitations.md index b4e5b5e..94940b7 100644 --- a/doc/limitations.md +++ b/doc/limitations.md @@ -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 diff --git a/doc/reference.md b/doc/reference.md index 3a03986..23e4c39 100644 --- a/doc/reference.md +++ b/doc/reference.md @@ -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 diff --git a/include/magic_enum/magic_enum.hpp b/include/magic_enum/magic_enum.hpp index 3ffc16f..cd728ec 100644 --- a/include/magic_enum/magic_enum.hpp +++ b/include/magic_enum/magic_enum.hpp @@ -218,8 +218,8 @@ struct enum_range { }; template -struct enum_range -: decltype(adl_magic_enum_define_range(E{})) {}; +struct enum_range +: 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."); diff --git a/test/test.cpp b/test/test.cpp index de1a73a..292392d 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -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(); } diff --git a/test/test_flags.cpp b/test/test_flags.cpp index 964bfe2..d1c566e 100644 --- a/test/test_flags.cpp +++ b/test/test_flags.cpp @@ -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(); }