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

Add ability to include external configuration header (#86)

* Add ability to include external configuration header

* Add documentation regarding MAGIC_ENUM_CONFIG_FILE
This commit is contained in:
sajimon 2021-06-17 15:06:27 +02:00 committed by GitHub
parent 8c130658e1
commit 081a77b96a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View file

@ -38,6 +38,22 @@
#define MAGIC_ENUM_USING_ALIAS_OPTIONAL template <typename T> using optional = my_lib::Optional<T>;
#include <magic_enum.hpp>
```
Optionally define `MAGIC_ENUM_CONFIG_FILE` i.e., in your build system, with path to header file with defined
macros or constants, for example:
```cpp
#define MAGIC_ENUM_CONFIG_FILE "my_magic_enum_cfg.hpp"
```
my_magic_enum_cfg.hpp:
```cpp
#include <my_lib/string.hpp>
#include <my_lib/string_view.hpp>
#define MAGIC_ENUM_USING_ALIAS_STRING using string = my_lib::String;
#define MAGIC_ENUM_USING_ALIAS_STRING_VIEW using string_view = my_lib::StringView;
#define MAGIC_ENUM_USING_ALIAS_OPTIONAL template <typename T> using optional = my_lib::Optional<T>;
#define MAGIC_ENUM_RANGE_MIN 0
#define MAGIC_ENUM_RANGE_MAX 255
```
## `enum_cast`