diff --git a/README.md b/README.md index 7885077..48b0fbb 100644 --- a/README.md +++ b/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() -> "BLUE" ``` * Nameof type @@ -80,6 +75,18 @@ Header-only C++17 library provides nameof macros and functions to obtain simple nameof::nameof_type() -> "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() + // var_type_name -> "int" + constexpr auto type_name = NAMEOF_VAR_TYPE(T); // or nameof::nameof_type() + // type_name -> "int" + ``` + ## Remarks * Nameof returns `std::string_view`. If argument does not have name, returns empty string.