update readme
This commit is contained in:
parent
b53ce6f0ac
commit
6c1aa3c09b
1 changed files with 12 additions and 5 deletions
17
README.md
17
README.md
|
@ -60,11 +60,6 @@ Header-only C++17 library provides nameof macros and functions to obtain simple
|
|||
// Name of enum variable.
|
||||
NAMEOF_ENUM(color) -> "RED"
|
||||
nameof::nameof_enum(color) -> "RED"
|
||||
|
||||
constexpr auto const_color = Color::BLUE;
|
||||
// Name of static storage enum variable.
|
||||
NAMEOF_CONST_ENUM(const_color) -> "BLUE"
|
||||
nameof::nameof_enum<const_color>() -> "BLUE"
|
||||
```
|
||||
|
||||
* Nameof type
|
||||
|
@ -80,6 +75,18 @@ Header-only C++17 library provides nameof macros and functions to obtain simple
|
|||
nameof::nameof_type<T>() -> "int"
|
||||
```
|
||||
|
||||
* Compile-time
|
||||
```cpp
|
||||
constexpr auto somevar_name = NAMEOF(somevar);
|
||||
// somevar_name -> "somevar"
|
||||
constexpr auto color_name = NAMEOF_ENUM(Color::BLUE); // or nameof::nameof_enum(Color::BLUE)
|
||||
// color_name -> "BLUE"
|
||||
constexpr auto var_type_name = NAMEOF_VAR_TYPE(var); // or nameof::nameof_type<decltype(var)>()
|
||||
// var_type_name -> "int"
|
||||
constexpr auto type_name = NAMEOF_VAR_TYPE(T); // or nameof::nameof_type<T>()
|
||||
// type_name -> "int"
|
||||
```
|
||||
|
||||
## Remarks
|
||||
|
||||
* Nameof returns `std::string_view`. If argument does not have name, returns empty string.
|
||||
|
|
Loading…
Reference in a new issue