update readme
This commit is contained in:
parent
c0e05bb407
commit
819c58c8eb
1 changed files with 25 additions and 2 deletions
27
README.md
27
README.md
|
@ -44,7 +44,7 @@ NAMEOF(SomeMethod<int, float>) -> "SomeMethod"
|
||||||
NAMEOF_FULL(SomeMethod<int, float>) -> "SomeMethod4<int, float>"
|
NAMEOF_FULL(SomeMethod<int, float>) -> "SomeMethod4<int, float>"
|
||||||
// Name of enum
|
// Name of enum
|
||||||
NAMEOF(SomeEnum::RED) -> "RED"
|
NAMEOF(SomeEnum::RED) -> "RED"
|
||||||
SomeEnum e = SomeEnum::RED;
|
auto e = SomeEnum::RED;
|
||||||
NAMEOF_ENUM(e) -> "RED"
|
NAMEOF_ENUM(e) -> "RED"
|
||||||
// Name of type
|
// Name of type
|
||||||
NAMEOF_TYPE(SomeEnum::RED) -> "SomeEnum"
|
NAMEOF_TYPE(SomeEnum::RED) -> "SomeEnum"
|
||||||
|
@ -104,13 +104,36 @@ void f() {
|
||||||
|
|
||||||
* The argument expression identifies a code definition, but it is never evaluated.
|
* 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
|
```cpp
|
||||||
NAMEOF_RAW(somevar.somefield) -> "somevar.somefield"
|
NAMEOF_RAW(somevar.somefield) -> "somevar.somefield"
|
||||||
NAMEOF_RAW(&SomeStruct::SomeMethod) -> "&SomeStruct::SomeMethod"
|
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<decltype(SomeEnum::RED)>() -> "SomeEnum"
|
||||||
|
nameof::NameofType<int> -> "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
|
* Spaces and Tabs ignored
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
|
|
Loading…
Reference in a new issue