From c427fd71c177bb2a317a52d52d260cd072dc82e7 Mon Sep 17 00:00:00 2001 From: terik23 Date: Tue, 26 Mar 2019 18:11:24 +0500 Subject: [PATCH] update readme --- README.md | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 398c17c..b23fdd6 100644 --- a/README.md +++ b/README.md @@ -38,31 +38,26 @@ Header-only C++17 library provides nameof macros and functions to obtain simple NAMEOF(somevar) -> "somevar" // Name of member variable NAMEOF(person.address.zip_code) -> "zip_code" - -constexpr auto cx_name = NAMEOF(somevar); -static_assert("somevar" == cx_name); ``` * Name of function ```cpp // Name of function -NAMEOF(some_method) -> "some_method" -NAMEOF_FULL(some_method) -> "some_method" -// Name of member function -NAMEOF(somevar.foo()) -> "foo" -NAMEOF_FULL(somevar.boo()) -> "boo" +NAMEOF(foo()) -> "foo" +NAMEOF_FULL(foo()) -> "foo" -constexpr auto cx_name = NAMEOF(somevar.foo()); -static_assert("foo" == cx_name); +// Name of member function +NAMEOF(somevar.some_method()) -> "some_method" +NAMEOF_FULL(somevar.some_method()) -> "some_method" ``` * Name of enum ```cpp -auto c = Color::RED; +auto color = Color::RED; // Name of enum variable -NAMEOF_ENUM(c) -> "RED" +NAMEOF_ENUM(color) -> "RED" // Name of enum variable -nameof::nameof_enum(c) -> "RED" +nameof::nameof_enum(color) -> "RED" constexpr auto cx_color = Color::BLUE; // Name of static storage enum variable @@ -71,26 +66,20 @@ nameof::nameof_enum() -> "BLUE" * Name of type ```cpp +using T = int; +T var = 42; // Name of variable type -NAMEOF_TYPE(Color::RED) -> "Color" +NAMEOF_TYPE(var) -> "int" +nameof::nameof_type() -> "int" // Name of type -NAMEOF_TYPE_T(int) -> "int" -// Name of variable type -nameof::nameof_type() -> "Color" -// Name of type -nameof::nameof_type() -> "int" - -constexpr auto cx_name = NAMEOF_TYPE(Color::RED); -static_assert("Color" == cx_name); +NAMEOF_TYPE_T(T) -> "int" +nameof::nameof_type() -> "int" ``` * Name of macro ```cpp // Name of macro NAMEOF(__LINE__) -> "__LINE__" - -constexpr auto cx_name = NAMEOF(__LINE__); -static_assert("__LINE__" == cx_name); ``` ## Remarks