update readme

This commit is contained in:
Neargye 2018-05-01 18:19:34 +05:00
parent cac2feff69
commit 0150c2f247

View file

@ -15,7 +15,7 @@ master |[![Build Status](https://travis-ci.org/Neargye/nameof.svg?branch=master)
C++ alternative to [nameof](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/nameof) operator in [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)). C++ alternative to [nameof](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/nameof) operator in [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)).
Used to obtain the simple name of a variable, type, member, function, macros and etc. Used to obtain the simple name of a variable, type, member, function, macros.
Before, you had to use string literals to refer to definitions, which is brittle when renaming code elements because tools do not know to check these string literals. Before, you had to use string literals to refer to definitions, which is brittle when renaming code elements because tools do not know to check these string literals.
A nameof macros expression has this form: A nameof macros expression has this form:
@ -33,7 +33,7 @@ std::cout << NAMEOF(person.address.zip_code) << std::endl; // prints "zip_code"
* Compile-time * Compile-time
* Compilation check * Compilation check
## [Example](example/example.cpp) & Key Use Cases ## [Examples](example/example.cpp)
* Name of a variable, member or function and etc * Name of a variable, member or function and etc
@ -113,7 +113,7 @@ 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 to get the fully-qualified name, you could use the NAMEOF_FULL(). * If you need fully-qualified name, use NAMEOF_FULL().
```cpp ```cpp
NAMEOF_FULL(somevar.somefield) -> "somevar.somefield" NAMEOF_FULL(somevar.somefield) -> "somevar.somefield"
@ -123,7 +123,7 @@ NAMEOF_FULL(std::string) -> "std::string"
## Integration ## Integration
You need to add the single required file [nameof.hpp](include/nameof.hpp), and the necessary switches to enable C++11. You should add required file [nameof.hpp](include/nameof.hpp) and switch to C++11.
## Compiler compatibility ## Compiler compatibility