diff --git a/README.md b/README.md index ba14f3d..48c3a6a 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,8 @@ ## What is Magic Enum? Header-only C++17 library provides Enum-to-String and String-to-Enum functions. -* `magic_enum::enum_to_string` used to obtain string enum name from enum variable. -* `magic_enum::enum_from_string` used to obtain enum variable from enum string name. +* `magic_enum::enum_to_string` obtains string enum name from enum variable. +* `magic_enum::enum_from_string` obtains enum variable from enum string name. ## Features @@ -63,11 +63,11 @@ Header-only C++17 library provides Enum-to-String and String-to-Enum functions. ## Remarks -* `magic_enum::enum_to_string` return `std::optional`, using `has_value()` to check contain enum name and `value()` to get enum name. If enum variable does not have name or out of range `MAGIC_ENUM_RANGE` return `std::nullopt`. +* `magic_enum::enum_to_string` returns `std::optional`, using `has_value()` to check contains enum name and `value()` to get the enum name. If enum variable does not have name or out of range `MAGIC_ENUM_RANGE`, returns `std::nullopt`. -* `magic_enum::enum_from_string` return `std::optional`, using `has_value()` to check contain enum variable and `value(`) to get enum variable. If enum variable does not have name or out of range `MAGIC_ENUM_RANGE` return `std::nullopt`. +* `magic_enum::enum_from_string` returns `std::optional`, using `has_value()` to check contains enum variable and `value()` to get the enum variable. If enum variable does not have name or out of range `MAGIC_ENUM_RANGE`, returns `std::nullopt`. -* Enum variable must be in range `(-MAGIC_ENUM_RANGE, MAGIC_ENUM_RANGE)`. By default `MAGIC_ENUM_RANGE = 128`. If you need a larger range, redefine the macro `MAGIC_ENUM_RANGE`. +* Enum variable must be in range `(-MAGIC_ENUM_RANGE, MAGIC_ENUM_RANGE)`. By default `MAGIC_ENUM_RANGE = 128`. If you need larger range, redefine the macro `MAGIC_ENUM_RANGE`. ```cpp #define MAGIC_ENUM_RANGE 1028 // Redefine MAGIC_ENUM_RANGE for larger range. #include @@ -75,7 +75,7 @@ Header-only C++17 library provides Enum-to-String and String-to-Enum functions. ## Integration -You have to add required file [magic_enum.hpp](include/magic_enum.hpp). +You should add the required file [magic_enum.hpp](include/magic_enum.hpp). ## Compiler compatibility diff --git a/include/magic_enum.hpp b/include/magic_enum.hpp index cb9ce4a..32556b1 100644 --- a/include/magic_enum.hpp +++ b/include/magic_enum.hpp @@ -166,7 +166,7 @@ struct enum_from_string_impl_t final { } // namespace detail -// enum_to_string(enum) used to obtain string enum name from enum variable. +// enum_to_string(enum) obtains string enum name from enum variable. template >>> [[nodiscard]] constexpr std::optional enum_to_string(T value) noexcept { constexpr bool s = std::is_signed_v>>; @@ -177,13 +177,13 @@ template return detail::enum_to_string_impl_t, min>{}(static_cast(value)); } -// enum_to_string() used to obtain string enum name from static storage enum variable +// enum_to_string() obtains string enum name from static storage enum variable. template >>> [[nodiscard]] constexpr std::optional enum_to_string() noexcept { return detail::enum_to_string_impl(); } -// enum_from_string(name) used to obtain enum variable from enum string name. +// enum_from_string(name) obtains enum variable from enum string name. template >> [[nodiscard]] constexpr std::optional enum_from_string(std::string_view name) noexcept { constexpr bool s = std::is_signed_v>;