diff --git a/doc/limitations.md b/doc/limitations.md index dcba8ba..e6f970a 100644 --- a/doc/limitations.md +++ b/doc/limitations.md @@ -4,7 +4,7 @@ # Nameof Type -* To check is nameof_type supported compiler use macro `NAMEOF_TYPE_SUPPORTED` or constexpr constant `nameof::is_nameof_type_supported`. +* To check is nameof type supported compiler use macro `NAMEOF_TYPE_SUPPORTED` or constexpr constant `nameof::is_nameof_type_supported`. * This library uses a compiler-specific hack (based on `__PRETTY_FUNCTION__` / `__FUNCSIG__`), which works on Clang >= 5, MSVC >= 15.3 and GCC >= 7. @@ -14,28 +14,28 @@ # Nameof Enum -* To check is nameof_enum supported compiler use macro `NAMEOF_ENUM_SUPPORTED` or constexpr constant `nameof::is_nameof_enum_supported`. +* To check is nameof enum supported compiler use macro `NAMEOF_ENUM_SUPPORTED` or constexpr constant `nameof::is_nameof_enum_supported`. * This library uses a compiler-specific hack (based on `__PRETTY_FUNCTION__` / `__FUNCSIG__`), which works on Clang >= 5, MSVC >= 15.3 and GCC >= 9. * Enum can't reflect if the enum is a forward declaration. -* Enum value must be in range `[MAGIC_ENUM_RANGE_MIN, MAGIC_ENUM_RANGE_MAX]`. By default `MAGIC_ENUM_RANGE_MIN = -128`, `MAGIC_ENUM_RANGE_MAX = 128`. +* Enum value must be in range `[NAMEOF_ENUM_RANGE_MIN, NAMEOF_ENUM_RANGE_MAX]`. By default `NAMEOF_ENUM_RANGE_MIN = -128`, `NAMEOF_ENUM_RANGE_MAX = 128`. -* If need another range for all enum types by default, redefine the macro `MAGIC_ENUM_RANGE_MIN` and `MAGIC_ENUM_RANGE_MAX`. +* If need another range for all enum types by default, redefine the macro `NAMEOF_ENUM_RANGE_MIN` and `NAMEOF_ENUM_RANGE_MAX`. ```cpp - #define MAGIC_ENUM_RANGE_MIN 0 - #define MAGIC_ENUM_RANGE_MAX 256 - #include + #define NAMEOF_ENUM_RANGE_MIN 0 + #define NAMEOF_ENUM_RANGE_MAX 256 + #include ``` * If need another range for specific enum type, add specialization `enum_range` for necessary enum type. ```cpp - #include + #include enum number { one = 100, two = 200, three = 300 }; - namespace magic_enum { + namespace nameof { template <> struct enum_range { static constexpr int min = 100; @@ -44,7 +44,7 @@ } ``` -* `magic_enum` obtains the first defined value enums, and won't work if value are aliased. +* Nameof enum obtains the first defined value enums, and won't work if value are aliased. ```cpp enum ShapeKind { ConvexBegin = 0, @@ -55,8 +55,8 @@ Banana = 3, COUNT = 4, }; - // magic_enum::enum_cast("Box") -> std::nullopt - // magic_enum::enum_name(ShapeKind::Box) -> "ConvexBegin" + // nameof::nameof_enum(ShapeKind::Box) -> "ConvexBegin" + // NAMEOF_ENUM(ShapeKind::Box) -> "ConvexBegin" ``` Work around the issue: ```cpp @@ -75,10 +75,10 @@ ConvexBegin = Box, ConvexEnd = Sphere + 1, }; - // magic_enum::enum_cast("Box") -> ShapeKind::Box - // magic_enum::enum_name(ShapeKind::Box) -> "Box" + // nameof::nameof_enum(ShapeKind::Box) -> "Box" + // NAMEOF_ENUM(ShapeKind::Box) -> "Box" // Non-reflected aliases. - // magic_enum::enum_cast("ConvexBegin") -> std::nullopt - // magic_enum::enum_name(ShapeKind::ConvexBegin) -> "Box" + // nameof::nameof_enum(ShapeKind::ConvexBegin) -> "Box" + // NAMEOF_ENUM(ShapeKind::ConvexBegin) -> "Box" ``` diff --git a/doc/reference.md b/doc/reference.md index f63d577..518959f 100644 --- a/doc/reference.md +++ b/doc/reference.md @@ -14,7 +14,7 @@ * [`NAMEOF_TYPE_EXPR` macro that obtains string name type of expression, reference and cv-qualifiers are ignored.](#NAMEOF_TYPE_EXPR) * [`NAMEOF_FULL_TYPE_EXPR` macro that obtains string name full type of expression, with reference and cv-qualifiers.](#NAMEOF_FULL_TYPE_EXPR) -## Synopsis +# Synopsis * Before use, read the [limitations](limitations.md) of functionality. diff --git a/include/nameof.hpp b/include/nameof.hpp index b25141d..6c2d07e 100644 --- a/include/nameof.hpp +++ b/include/nameof.hpp @@ -381,7 +381,7 @@ constexpr std::size_t reflected_size() { static_assert(reflected_max_v > reflected_min_v, "nameof::enum_range requires max > min."); constexpr auto size = reflected_max_v - reflected_min_v + 1; static_assert(size > 0, "nameof::enum_range requires valid size."); - static_assert(size < (std::numeric_limits::max)(), "magic_enum::enum_range requires valid size."); + static_assert(size < (std::numeric_limits::max)(), "nameof::enum_range requires valid size."); return static_cast(size); } @@ -415,7 +415,7 @@ constexpr std::size_t range_size() noexcept { static_assert(is_enum_v, "nameof::detail::range_size requires enum type."); constexpr auto size = max_v - min_v + 1; static_assert(size > 0, "nameof::enum_range requires valid size."); - static_assert(size < (std::numeric_limits::max)(), "magic_enum::enum_range requires valid size."); + static_assert(size < (std::numeric_limits::max)(), "nameof::enum_range requires valid size."); return static_cast(size); }