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

update doc

This commit is contained in:
neargye 2023-08-14 18:41:40 +04:00
parent 4904822db8
commit 45c8b5d92c
3 changed files with 17 additions and 1 deletions

View file

@ -54,6 +54,12 @@ int main() {
std::cout << "BLUE = " << to_integer(c2.value()) << std::endl; // BLUE = 0
}
// Case insensitive enum_cast.
c2 = magic_enum::enum_cast<Color>("blue", magic_enum::case_insensitive);
if (c2.has_value()) {
std::cout << "BLUE = " << to_integer(c2.value()) << std::endl; // BLUE = 0
}
// Integer value to enum value.
auto c3 = magic_enum::enum_cast<Color>(10);
if (c3.has_value()) {