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

update doc

This commit is contained in:
neargye 2024-11-19 23:47:49 +02:00
parent 715b442682
commit 84990c60b2
3 changed files with 5 additions and 3 deletions

View file

@ -25,6 +25,8 @@ If you like this project, please consider donating to one of the funds that help
* Enum value to string
```cpp
#include <magic_enum/magic_enum.hpp>
//....
Color color = Color::RED;
auto color_name = magic_enum::enum_name(color);
// color_name -> "RED"

View file

@ -34,13 +34,13 @@
```cpp
#define MAGIC_ENUM_RANGE_MIN 0
#define MAGIC_ENUM_RANGE_MAX 256
#include <magic_enum.hpp>
#include <magic_enum/magic_enum.hpp>
```
* If you need a different range for a specific enum type, add the specialization `enum_range` for the enum type. Specializations of `enum_range` must be injected in `namespace magic_enum::customize`.
```cpp
#include <magic_enum.hpp>
#include <magic_enum/magic_enum.hpp>
enum class number { one = 100, two = 200, three = 300 };

View file

@ -43,7 +43,7 @@
#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>;
#include <magic_enum.hpp>
#include <magic_enum/magic_enum.hpp>
```
* Optionally define `MAGIC_ENUM_CONFIG_FILE` i.e., in your build system, with path to header file with defined