From dee5abdfbd79e3f2bd9ad5e698aa4bfe926baf64 Mon Sep 17 00:00:00 2001 From: neargye Date: Wed, 23 Dec 2020 14:14:28 +0200 Subject: [PATCH] update doc fix #68 --- doc/limitations.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/doc/limitations.md b/doc/limitations.md index 1d10e0f..f1021d7 100644 --- a/doc/limitations.md +++ b/doc/limitations.md @@ -48,10 +48,10 @@ ConvexEnd = 2, Donut = 2, // Won't work too. Banana = 3, - COUNT = 4, + COUNT = 4 }; - // magic_enum::enum_cast("Box") -> std::nullopt or ShapeKind::Box - // magic_enum::enum_name(ShapeKind::Box) -> "ConvexBegin" or "" + // magic_enum::enum_cast("Box") -> std::nullopt + // magic_enum::enum_name(ShapeKind::Box) -> "ConvexBegin" ``` One of the possible workaround the issue: @@ -70,7 +70,7 @@ // Non-reflected aliases. ConvexBegin = Box, - ConvexEnd = Sphere + 1, + ConvexEnd = Sphere + 1 }; // magic_enum::enum_cast("Box") -> ShapeKind::Box // magic_enum::enum_name(ShapeKind::Box) -> "Box" @@ -80,9 +80,18 @@ // magic_enum::enum_name(ShapeKind::ConvexBegin) -> "Box" ``` - On some compiler enum-aliases not supported, [for example Visual Studio 2017](https://github.com/Neargye/magic_enum/issues/36). + On some compiler enum-aliases not supported, [for example Visual Studio 2017](https://github.com/Neargye/magic_enum/issues/36), macro `MAGIC_ENUM_SUPPORTED_ALIASES` will be undefined. - It is possible to check whether enum-aliases supported using a macro `MAGIC_ENUM_SUPPORTED_ALIASES`. + ```cpp + enum Number { + one = 1, + ONE = 1 + }; + // magic_enum::enum_cast("one") -> std::nullopt + // magic_enum::enum_name(Number::one) -> "" + // magic_enum::enum_cast("ONE") -> std::nullopt + // magic_enum::enum_name(Number::ONE) -> "" + ``` * If you hit a message like this: