From 40e12d62295baabe3410bf55528fd5ca1ee987cf Mon Sep 17 00:00:00 2001 From: neargye Date: Mon, 14 Aug 2023 18:53:15 +0400 Subject: [PATCH] update readme --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 2c0dec0..009da75 100644 --- a/README.md +++ b/README.md @@ -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(value, magic_enum::case_insensitive); + + // enum_cast with BinaryPredicate + auto color = magic_enum::enum_cast(value, [](char lhs, char rhs) { return std::tolower(lhs) == std::tolower(rhs); } + + // enum_cast with default auto color_or_default = magic_enum::enum_cast(value).value_or(Color::NONE); ```