Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Neargye committed Aug 14, 2023
1 parent 45c8b5d commit 40e12d6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
```
Expand Down

0 comments on commit 40e12d6

Please sign in to comment.