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:
parent
32e2e6318d
commit
d73a985f52
3 changed files with 8 additions and 4 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue