mirror of
https://github.com/Neargye/magic_enum.git
synced 2026-01-09 23:34:23 +00:00
update readme
This commit is contained in:
parent
45c8b5d92c
commit
40e12d6229
1 changed files with 7 additions and 0 deletions
|
|
@ -49,6 +49,13 @@ Header-only C++17 library provides static reflection for enums, work with any en
|
|||
// color.value() -> Color::GREEN
|
||||
}
|
||||
|
||||
// case insensitive enum_cast
|
||||
auto color = magic_enum::enum_cast<Color>(value, magic_enum::case_insensitive);
|
||||
|
||||
// enum_cast with BinaryPredicate
|
||||
auto color = magic_enum::enum_cast<Color>(value, [](char lhs, char rhs) { return std::tolower(lhs) == std::tolower(rhs); }
|
||||
|
||||
// enum_cast with default
|
||||
auto color_or_default = magic_enum::enum_cast<Color>(value).value_or(Color::NONE);
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue