From bc88d7d613d69d6fd9fe1098e02be6c08fdf8ead Mon Sep 17 00:00:00 2001 From: neargye Date: Fri, 5 Apr 2019 19:21:21 +0500 Subject: [PATCH] update example --- example/example.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/example/example.cpp b/example/example.cpp index d7786a2..e68985b 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -88,15 +88,17 @@ int main() { constexpr auto name = NAMEOF(structvar); static_assert("structvar" == name); - // Enum name. + // Nameof enum variable. auto color = Color::RED; - std::cout << NAMEOF_ENUM(color) << std::endl; // RED std::cout << nameof::nameof_enum(color) << std::endl; // RED + std::cout << NAMEOF_ENUM(color) << std::endl; // RED + + // Nameof static storage enum variable. constexpr auto const_color = Color::BLUE; std::cout << nameof::nameof_enum() << std::endl; // BLUE std::cout << NAMEOF_CONST_ENUM(const_color) << std::endl; // BLUE - // Variable name. + // Nameof. std::cout << NAMEOF(structvar) << std::endl; // structvar std::cout << NAMEOF(::structvar) << std::endl; // structvar std::cout << NAMEOF(structvar.somefield) << std::endl; // somefield @@ -104,36 +106,36 @@ int main() { std::cout << NAMEOF(othervar.ll.field) << std::endl; // field std::cout << NAMEOF(ptrvar) << std::endl; // 'ptrvar' - // Function name. + // Nameof function. std::cout << NAMEOF(&SomeStruct::SomeMethod1) << std::endl; // SomeMethod1 std::cout << NAMEOF(structvar.SomeMethod2()) << std::endl; // SomeMethod2 std::cout << NAMEOF(SomeMethod3) << std::endl; // SomeMethod3 - std::cout << NAMEOF(SomeMethod4(1.0f)) << std::endl; // SomeMethod4 std::cout << NAMEOF(SomeMethod4) << std::endl; // SomeMethod4 - std::cout << NAMEOF_FULL(SomeMethod4) << std::endl; // SomeMethod4 - std::cout << NAMEOF(&SomeClass::SomeMethod5) << std::endl; // SomeMethod5 - std::cout << NAMEOF(&SomeClass::SomeMethod6) << std::endl; // SomeMethod6 + + // Nameof with template suffix. + std::cout << NAMEOF_FULL(SomeMethod4) << std::endl; // SomeMethod4 std::cout << NAMEOF_FULL(&SomeClass::SomeMethod6) << std::endl; // SomeMethod6 - // Type name. - std::cout << NAMEOF_VAR_TYPE(structvar) << std::endl; // SomeStruct + // Nameof variable type. std::cout << nameof::nameof_type() << std::endl; // SomeStruct + std::cout << NAMEOF_VAR_TYPE(structvar) << std::endl; // SomeStruct std::cout << NAMEOF_VAR_TYPE(SomeClass{}) << std::endl; // SomeClass std::cout << NAMEOF_VAR_TYPE(othervar.ll) << std::endl; // Long::LL std::cout << NAMEOF_VAR_TYPE(std::declval>()) << std::endl; // const SomeClass && + // Nameof type. + std::cout << nameof::nameof_type>() << std::endl; // SomeClass std::cout << NAMEOF_TYPE(const SomeClass volatile *) << std::endl; // const volatile SomeClass * std::cout << NAMEOF_TYPE(SomeClass) << std::endl; // SomeClass - std::cout << nameof::nameof_type>() << std::endl; // SomeClass - // Macro name. + // Nameof macro. std::cout << NAMEOF(__LINE__) << std::endl; // __LINE__ std::cout << NAMEOF(NAMEOF(structvar)) << std::endl; // 'NAMEOF' - // Raw name. + // Nameof raw. std::cout << NAMEOF_RAW(structvar.somefield) << std::endl; // structvar.somefield std::cout << NAMEOF_RAW(&SomeStruct::SomeMethod1) << std::endl; // &SomeStruct::SomeMethod1