From f059e71c6f244c9f52e00a950f34d858588e148c Mon Sep 17 00:00:00 2001 From: neargye Date: Tue, 30 Apr 2019 19:03:50 +0500 Subject: [PATCH] update readme --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 84c2b31..d2319d6 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ enum Color { RED = 2, BLUE = 4, GREEN = 8 }; // color_names[0] -> "RED" ``` -* Enum names sequence +* Enum entries sequence ```cpp constexpr auto color_entries = magic_enum::enum_entries(); // color_entries -> {{Color::RED, "RED"}, {Color::BLUE, "BLUE"}, {Color::GREEN, "GREEN"}} @@ -190,6 +190,8 @@ enum Color { RED = 2, BLUE = 4, GREEN = 8 }; * `magic_enum::enum_names` returns `std::array` with all string enum name where `N = number of enum values`, sorted by enum value. +* `magic_enum::enum_entries` returns `std::array, N>` with all std::pair (value enum, string enum name) where `N = number of enum values`, sorted by enum value. + * Enum value must be in range `[MAGIC_ENUM_RANGE_MIN, MAGIC_ENUM_RANGE_MAX]`. By default `MAGIC_ENUM_RANGE_MIN = -128`, `MAGIC_ENUM_RANGE_MAX = 128`. If need another range for all enum types by default, redefine the macro `MAGIC_ENUM_RANGE_MIN` and `MAGIC_ENUM_RANGE_MAX`. @@ -214,7 +216,7 @@ enum Color { RED = 2, BLUE = 4, GREEN = 8 }; } ``` -* `magic_enum::enum_cast` and `magic_enum::enum_name` obtains the first defined value enums, and won't work if value are aliased. +* `magic_enum` obtains the first defined value enums, and won't work if value are aliased. ```cpp enum ShapeKind { ConvexBegin = 0,