From 49d2429cf110f804048bc459b1d2c126d43b0a9a Mon Sep 17 00:00:00 2001 From: neargye Date: Sat, 26 Oct 2019 22:08:46 +0500 Subject: [PATCH] update doc and example --- doc/reference.md | 4 ++-- example/example.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/reference.md b/doc/reference.md index 8fc1cf0..566028f 100644 --- a/doc/reference.md +++ b/doc/reference.md @@ -251,7 +251,7 @@ template basic_ostream& operator<<(basic_ostream& os, optional value); ``` -* Out-of-the-box ostream operators for enums. +* Out-of-the-box ostream operators for all enums. * Examples ```cpp @@ -284,7 +284,7 @@ template constexpr E& operator^=(E& lhs, E rhs) noexcept; ``` -* Out-of-the-box bitwise operators for enums. +* Out-of-the-box bitwise operators for all enums. * Examples ```cpp diff --git a/example/example.cpp b/example/example.cpp index 2294a58..16b651f 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -59,7 +59,7 @@ int main() { std::cout << "RED = " << color_integer << std::endl; // RED = -10 } - using namespace magic_enum::ostream_operators; // out-of-the-box ostream operator for enums. + using namespace magic_enum::ostream_operators; // out-of-the-box ostream operator for all enums. // ostream operator for enum. std::cout << "Color: " << c1 << " " << c2 << " " << c3 << std::endl; // Color: RED BLUE GREEN @@ -78,10 +78,10 @@ int main() { std::cout << std::endl; // Color sequence: RED BLUE GREEN - enum class Flags { A = 1 << 0, B = 1 << 1, C = 1 << 2, D = 1 << 3 }; - using namespace magic_enum::bitwise_operators; // out-of-the-box bitwise operators for enums. + enum class Flags { A = 1, B = 2, C = 4, D = 8 }; + using namespace magic_enum::bitwise_operators; // out-of-the-box bitwise operators for all enums. // Support operators: ~, |, &, ^, |=, &=, ^=. - Flags flags = Flags::A & ~Flags::C; + Flags flags = Flags::A | Flags::C; std::cout << flags << std::endl; enum color { red, green, blue };