From 3edfd58e59356c5dd3419e19fc43ae34612c7818 Mon Sep 17 00:00:00 2001 From: neargye Date: Tue, 3 Sep 2019 17:53:26 +0500 Subject: [PATCH] clean-up naming --- include/magic_enum.hpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/include/magic_enum.hpp b/include/magic_enum.hpp index 4e66766..5ef4a9a 100644 --- a/include/magic_enum.hpp +++ b/include/magic_enum.hpp @@ -83,7 +83,7 @@ static_assert(MAGIC_ENUM_RANGE_MAX > MAGIC_ENUM_RANGE_MIN, namespace detail { template -struct magic_enum_supported final +struct supported final #if defined(__clang__) || defined(__GNUC__) && __GNUC__>= 9 || defined(_MSC_VER) || defined(MAGIC_ENUM_NO_CHECK_SUPPORT) : std::true_type {}; #else @@ -282,7 +282,7 @@ struct underlying_type : std::underlying_type {}; } // namespace magic_enum::detail // Checks is magic_enum supported compiler. -inline constexpr bool is_magic_enum_supported = detail::magic_enum_supported::value; +inline constexpr bool is_magic_enum_supported = detail::supported::value; // Checks whether T is an Unscoped enumeration type. // Provides the member constant value which is equal to true, if T is an [Unscoped enumeration](https://en.cppreference.com/w/cpp/language/enum#Unscoped_enumeration) type. Otherwise, value is equal to false. @@ -320,7 +320,7 @@ using underlying_type_t = typename underlying_type::type; // Returns std::optional with enum value. template > [[nodiscard]] constexpr std::optional enum_cast(std::string_view value) noexcept { - static_assert(detail::magic_enum_supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); + static_assert(detail::supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); static_assert(detail::check_enum_v, "magic_enum::enum_cast requires enum type."); constexpr auto values = detail::values_v; constexpr auto count = detail::count_v; @@ -339,7 +339,7 @@ template > // Returns std::optional with enum value. template > [[nodiscard]] constexpr std::optional enum_cast(std::underlying_type_t value) noexcept { - static_assert(detail::magic_enum_supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); + static_assert(detail::supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); static_assert(detail::check_enum_v, "magic_enum::enum_cast requires enum type."); if (detail::name(static_cast(value)).empty()) { @@ -352,7 +352,7 @@ template > // Returns integer value from enum value. template > [[nodiscard]] constexpr std::underlying_type_t enum_integer(E value) noexcept { - static_assert(detail::magic_enum_supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); + static_assert(detail::supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); static_assert(detail::check_enum_v, "magic_enum::enum_integer requires enum type."); return static_cast>(value); @@ -362,7 +362,7 @@ template > // No bounds checking is performed: the behavior is undefined if index >= number of enum values. template> [[nodiscard]] constexpr D enum_value(std::size_t index) { - static_assert(detail::magic_enum_supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); + static_assert(detail::supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); static_assert(detail::check_enum_v, "magic_enum::enum_value requires enum type."); constexpr auto values = detail::values_v; @@ -373,7 +373,7 @@ template> // Returns std::array with enum values, sorted by enum value. template > [[nodiscard]] constexpr auto enum_values() noexcept { - static_assert(detail::magic_enum_supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); + static_assert(detail::supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); static_assert(detail::check_enum_v, "magic_enum::enum_values requires enum type."); constexpr auto values = detail::values_v; @@ -383,7 +383,7 @@ template > // Returns number of enum values. template > [[nodiscard]] constexpr std::size_t enum_count() noexcept { - static_assert(detail::magic_enum_supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); + static_assert(detail::supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); static_assert(detail::check_enum_v, "magic_enum::enum_count requires enum type."); constexpr auto count = detail::count_v; @@ -394,7 +394,7 @@ template > // This version is much lighter on the compile times and is not restricted to the enum_range limitation. template > [[nodiscard]] constexpr std::string_view enum_name() noexcept { - static_assert(detail::magic_enum_supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); + static_assert(detail::supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); static_assert(detail::check_enum_v, "magic_enum::enum_name requires enum type."); return detail::name_v; @@ -403,7 +403,7 @@ template > // Returns string enum name from enum value. template > [[nodiscard]] constexpr std::string_view enum_name(E value) noexcept { - static_assert(detail::magic_enum_supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); + static_assert(detail::supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); static_assert(detail::check_enum_v, "magic_enum::enum_name requires enum type."); return detail::name(value); @@ -413,7 +413,7 @@ template > // Returns std::array with string enum names, sorted by enum value. template > [[nodiscard]] constexpr auto enum_names() noexcept { - static_assert(detail::magic_enum_supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); + static_assert(detail::supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); static_assert(detail::check_enum_v, "magic_enum::enum_names requires enum type."); constexpr auto names = detail::names_v; @@ -424,7 +424,7 @@ template > // Returns std::array with std::pair (value enum, string enum name), sorted by enum value. template > [[nodiscard]] constexpr auto enum_entries() noexcept { - static_assert(detail::magic_enum_supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); + static_assert(detail::supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); static_assert(detail::check_enum_v, "magic_enum::enum_entries requires enum type."); constexpr auto entries = detail::entries_v; @@ -433,9 +433,9 @@ template > namespace ostream_operators { -template > +template > std::basic_ostream& operator<<(std::basic_ostream& os, E value) { - static_assert(detail::magic_enum_supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); + static_assert(detail::supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); static_assert(detail::check_enum_v, "magic_enum::ostream_operators::operator<< requires enum type."); if (auto name = detail::name(value); !name.empty()) { @@ -449,9 +449,9 @@ std::basic_ostream& operator<<(std::basic_ostream& o return os; } -template > +template > std::basic_ostream& operator<<(std::basic_ostream& os, std::optional value) { - static_assert(detail::magic_enum_supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); + static_assert(detail::supported::value, "magic_enum: Unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); static_assert(detail::check_enum_v, "magic_enum::ostream_operators::operator<< requires enum type."); if (value.has_value()) {