mirror of
https://github.com/Neargye/magic_enum.git
synced 2026-01-09 23:34:23 +00:00
remove is_fixed_enum
non stable and useless
This commit is contained in:
parent
c947afdbae
commit
105c8f067e
4 changed files with 0 additions and 30 deletions
|
|
@ -34,7 +34,6 @@ Header-only C++17 library provides static reflection for enums, work with any en
|
|||
* `enum_index` obtains index in enum value sequence from enum value.
|
||||
* `is_unscoped_enum` checks whether type is an [Unscoped enumeration](https://en.cppreference.com/w/cpp/language/enum#Unscoped_enumeration).
|
||||
* `is_scoped_enum` checks whether type is an [Scoped enumeration](https://en.cppreference.com/w/cpp/language/enum#Scoped_enumerations).
|
||||
* `is_fixed_enum` checks whether type is an [Fixed enumeration](https://en.cppreference.com/w/cpp/language/enum).
|
||||
* `underlying_type` improved UB-free "SFINAE-friendly" [std::underlying_type](https://en.cppreference.com/w/cpp/types/underlying_type).
|
||||
* `using namespace magic_enum::ostream_operators;` ostream operators for enums.
|
||||
* `using namespace magic_enum::bitwise_operators;` bitwise operators for enums.
|
||||
|
|
|
|||
|
|
@ -96,13 +96,6 @@ int main() {
|
|||
static_assert(magic_enum::is_scoped_enum_v<Color>);
|
||||
static_assert(magic_enum::is_scoped_enum_v<Flags>);
|
||||
|
||||
// Checks whether type is an Fixed enumeration.
|
||||
#if defined(_MSC_VER) && _MSC_VER != 1923 // MSVC bug, we can not check is enum fixed
|
||||
static_assert(!magic_enum::is_fixed_enum_v<color>);
|
||||
static_assert(magic_enum::is_fixed_enum_v<Color>);
|
||||
static_assert(magic_enum::is_fixed_enum_v<Flags>);
|
||||
#endif
|
||||
|
||||
// Enum pair (value enum, string enum name) sequence.
|
||||
constexpr auto color_entries = magic_enum::enum_entries<Color>();
|
||||
std::cout << "Colors entries:";
|
||||
|
|
|
|||
|
|
@ -314,12 +314,6 @@ struct is_unscoped_enum : std::false_type {};
|
|||
template <typename T>
|
||||
struct is_unscoped_enum<T, true> : std::bool_constant<std::is_convertible_v<T, std::underlying_type_t<T>>> {};
|
||||
|
||||
template <typename T, typename = T>
|
||||
struct is_fixed_enum : std::false_type {};
|
||||
|
||||
template <typename T>
|
||||
struct is_fixed_enum<T, decltype(T{0})> : std::is_enum<T> {};
|
||||
|
||||
template <typename T, bool = std::is_enum_v<T>>
|
||||
struct underlying_type {};
|
||||
|
||||
|
|
@ -347,14 +341,6 @@ struct is_scoped_enum : detail::is_scoped_enum<T> {};
|
|||
template <typename T>
|
||||
inline constexpr bool is_scoped_enum_v = is_scoped_enum<T>::value;
|
||||
|
||||
// Checks whether T is an Fixed enumeration type.
|
||||
// Provides the member constant value which is equal to true, if T is an [Fixed enumeration](https://en.cppreference.com/w/cpp/language/enum) type. Otherwise, value is equal to false.
|
||||
template <typename T>
|
||||
struct is_fixed_enum : detail::is_fixed_enum<T> {};
|
||||
|
||||
template <typename T>
|
||||
inline constexpr bool is_fixed_enum_v = is_fixed_enum<T>::value;
|
||||
|
||||
// If T is a complete enumeration type, provides a member typedef type that names the underlying type of T.
|
||||
// Otherwise, if T is not an enumeration type, there is no member type. Otherwise (T is an incomplete enumeration type), the program is ill-formed.
|
||||
template <typename T>
|
||||
|
|
@ -375,7 +361,6 @@ struct enum_traits<E, std::enable_if_t<detail::is_enum_v<E>>> {
|
|||
|
||||
inline static constexpr bool is_unscoped_enum = is_unscoped_enum_v<E>;
|
||||
inline static constexpr bool is_scoped_enum = is_scoped_enum_v<E>;
|
||||
inline static constexpr bool is_fixed_enum = is_fixed_enum_v<E>;
|
||||
|
||||
inline static constexpr std::size_t count = detail::count_v<E>;
|
||||
inline static constexpr std::array<E, count> values = detail::values<E>(detail::range_v<E>);
|
||||
|
|
|
|||
|
|
@ -453,13 +453,6 @@ TEST_CASE("type_traits") {
|
|||
REQUIRE(is_scoped_enum_v<Numbers>);
|
||||
REQUIRE_FALSE(is_scoped_enum_v<Directions>);
|
||||
REQUIRE_FALSE(is_scoped_enum_v<number>);
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER != 1923 // MSVC bug, we can not check is enum fixed
|
||||
REQUIRE(is_fixed_enum_v<Color>);
|
||||
REQUIRE(is_fixed_enum_v<Numbers>);
|
||||
REQUIRE_FALSE(is_fixed_enum_v<Directions>);
|
||||
REQUIRE(is_fixed_enum_v<number>);
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_CASE("enum_traits") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue