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

change check support compiler

This commit is contained in:
neargye 2019-10-02 15:28:53 +05:00
parent 75c9d9bce5
commit c947afdbae
2 changed files with 25 additions and 23 deletions

View file

@ -33,7 +33,7 @@ int main() {
std::cout << c1_name << std::endl; // RED
// String enum name sequence.
constexpr auto& color_names = magic_enum::enum_names<Color>();
constexpr auto color_names = magic_enum::enum_names<Color>();
std::cout << "Color names:";
for (auto n : color_names) {
std::cout << " " << n;
@ -70,7 +70,7 @@ int main() {
std::cout << "Color[0] = " << magic_enum::enum_value<Color>(0) << std::endl; // Color[0] = RED
// Enum value sequence.
constexpr auto& colors = magic_enum::enum_values<Color>();
constexpr auto colors = magic_enum::enum_values<Color>();
std::cout << "Colors sequence:";
for (Color c : colors) {
std::cout << " " << c; // ostream operator for enum.
@ -106,7 +106,7 @@ int main() {
// Enum pair (value enum, string enum name) sequence.
constexpr auto color_entries = magic_enum::enum_entries<Color>();
std::cout << "Colors entries:";
for (auto& e : color_entries) {
for (auto e : color_entries) {
std::cout << " " << e.second << " = " << static_cast<int>(e.first);
}
std::cout << std::endl;