From 819c58c8ebe37da07f4a083fcad1d9afbb149147 Mon Sep 17 00:00:00 2001 From: Neargye Date: Tue, 4 Sep 2018 18:51:22 +0500 Subject: [PATCH] update readme --- README.md | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 067ad42..be82855 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ NAMEOF(SomeMethod) -> "SomeMethod" NAMEOF_FULL(SomeMethod) -> "SomeMethod4" // Name of enum NAMEOF(SomeEnum::RED) -> "RED" -SomeEnum e = SomeEnum::RED; +auto e = SomeEnum::RED; NAMEOF_ENUM(e) -> "RED" // Name of type NAMEOF_TYPE(SomeEnum::RED) -> "SomeEnum" @@ -104,13 +104,36 @@ void f() { * The argument expression identifies a code definition, but it is never evaluated. -* If you need raw fully-qualified name, use NAMEOF_RAW. +* If you need raw fully-qualified name, use NAMEOF_RAW(). ```cpp NAMEOF_RAW(somevar.somefield) -> "somevar.somefield" NAMEOF_RAW(&SomeStruct::SomeMethod) -> "&SomeStruct::SomeMethod" ``` +* Instead of macros NAMEOF_ENUM, you can use the function nameof::NameofEnum(). + +```cpp +nameof::NameofEnum(SomeEnum::RED) -> "RED" +auto e = SomeEnum::RED; +nameof::NameofEnum(e) -> "RED" +``` + +* Instead of macros NAMEOF_TYPE, you can use the function nameof::NameofType<>. + +```cpp +nameof::NameofType() -> "SomeEnum" +nameof::NameofType -> "int" +``` + +* NAMEOF_ENUM does not work on the GCC. + +```cpp +// On GCC. +auto e = SomeEnum::RED; +NAMEOF_ENUM(e) -> "(SomeEnum)0" +``` + * Spaces and Tabs ignored ```cpp