mirror of
https://github.com/Neargye/magic_enum.git
synced 2026-01-09 23:34:23 +00:00
improve customize
This commit is contained in:
parent
000551a655
commit
690486e7f2
5 changed files with 107 additions and 49 deletions
|
|
@ -22,14 +22,14 @@
|
|||
#include <magic_enum.hpp>
|
||||
```
|
||||
|
||||
* If need another range for specific enum type, add specialization `enum_range` for necessary enum type. Specialization of `enum_range` must be injected in `namespace magic_enum`.
|
||||
* If need another range for specific enum type, add specialization `enum_range` for necessary enum type. Specialization of `enum_range` must be injected in `namespace magic_enum::customize`.
|
||||
|
||||
```cpp
|
||||
#include <magic_enum.hpp>
|
||||
|
||||
enum class number { one = 100, two = 200, three = 300 };
|
||||
|
||||
namespace magic_enum {
|
||||
namespace magic_enum::customize {
|
||||
template <>
|
||||
struct enum_range<number> {
|
||||
static constexpr int min = 100; // Must be greater than `INT16_MIN`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue