From f5d5d84dc54e6402de837823dfeb605dbb2c796d Mon Sep 17 00:00:00 2001 From: Neargye Date: Sun, 15 Apr 2018 00:49:27 +0500 Subject: [PATCH] update readme --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 37fec8d..83cb7d9 100644 --- a/README.md +++ b/README.md @@ -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)). -Used to obtain the simple name of a variable, type, member or function and etc. +Used to obtain the simple name of a variable, type, member, function, macros and etc. 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: @@ -57,6 +57,13 @@ NAMEOF(volatile const int) -> "volatile const int int" NAMEOF(std::string) -> "string" ``` +* Name of macros + +```cpp +NAMEOF(__LINE__) -> "__LINE__" +NAMEOF(__FILE__) -> "__FILE__" +``` + * Constexpr ```cpp