1
0
Fork 0
mirror of https://github.com/Neargye/magic_enum.git synced 2026-01-10 23:44:29 +00:00

add MAGIC_ENUM_SUPPORTED_ALIASES

This commit is contained in:
neargye 2020-08-15 23:56:54 +05:00
parent 32e2e6318d
commit d73a985f52
3 changed files with 8 additions and 4 deletions

View file

@ -82,6 +82,8 @@
On some compiler enum-aliases not supported, [for example Visual Studio 2017](https://github.com/Neargye/magic_enum/issues/36). On some compiler enum-aliases not supported, [for example Visual Studio 2017](https://github.com/Neargye/magic_enum/issues/36).
It is possible to check whether enum-aliases supported using a macro `MAGIC_ENUM_SUPPORTED_ALIASES`.
* If you hit a message like this: * If you hit a message like this:
```text ```text

View file

@ -62,6 +62,12 @@
# define MAGIC_ENUM_SUPPORTED 1 # define MAGIC_ENUM_SUPPORTED 1
#endif #endif
// Checks magic_enum compiler aliases compatibility.
#if defined(__clang__) && __clang_major__ >= 5 || defined(__GNUC__) && __GNUC__ >= 9 || defined(_MSC_VER) && _MSC_VER >= 1920
# undef MAGIC_ENUM_SUPPORTED_ALIASES
# define MAGIC_ENUM_SUPPORTED_ALIASES 1
#endif
// Enum value must be greater or equals than MAGIC_ENUM_RANGE_MIN. By default MAGIC_ENUM_RANGE_MIN = -128. // Enum value must be greater or equals than MAGIC_ENUM_RANGE_MIN. By default MAGIC_ENUM_RANGE_MIN = -128.
// If need another min range for all enum types by default, redefine the macro MAGIC_ENUM_RANGE_MIN. // If need another min range for all enum types by default, redefine the macro MAGIC_ENUM_RANGE_MIN.
#if !defined(MAGIC_ENUM_RANGE_MIN) #if !defined(MAGIC_ENUM_RANGE_MIN)

View file

@ -27,10 +27,6 @@
#define MAGIC_ENUM_RANGE_MAX 120 #define MAGIC_ENUM_RANGE_MAX 120
#include <magic_enum.hpp> #include <magic_enum.hpp>
#if defined(_MSC_VER) && _MSC_VER >= 1920 || defined(__clang__) && __clang_major__ >= 5 || defined(__GNUC__) && __GNUC__ >= 9
# define MAGIC_ENUM_SUPPORTED_ALIASES
#endif
#include <array> #include <array>
#include <cctype> #include <cctype>
#include <string_view> #include <string_view>