update example
This commit is contained in:
parent
481f928f4d
commit
71b8d3d946
1 changed files with 6 additions and 4 deletions
|
@ -66,7 +66,7 @@ class SomeClass {
|
||||||
template <typename C>
|
template <typename C>
|
||||||
C SomeMethod6() const {
|
C SomeMethod6() const {
|
||||||
C t{};
|
C t{};
|
||||||
std::cout << NAMEOF_VAR_TYPE(t) << std::endl;
|
std::cout << NAMEOF_TYPE_EXPR(t) << std::endl;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -116,14 +116,16 @@ int main() {
|
||||||
|
|
||||||
// Nameof variable type.
|
// Nameof variable type.
|
||||||
std::cout << nameof::nameof_type<decltype(structvar)>() << std::endl; // 'SomeStruct'
|
std::cout << nameof::nameof_type<decltype(structvar)>() << std::endl; // 'SomeStruct'
|
||||||
std::cout << NAMEOF_VAR_TYPE(structvar) << std::endl; // 'SomeStruct'
|
std::cout << NAMEOF_TYPE_EXPR(structvar) << std::endl; // 'SomeStruct'
|
||||||
std::cout << NAMEOF_VAR_TYPE(SomeClass<int>{}) << std::endl; // 'SomeClass<int>'
|
std::cout << NAMEOF_TYPE_EXPR(othervar.ll) << std::endl; // 'Long::LL'
|
||||||
std::cout << NAMEOF_VAR_TYPE(othervar.ll) << std::endl; // 'Long::LL'
|
std::cout << NAMEOF_TYPE_EXPR(std::declval<const SomeClass<int>>()) << std::endl; // 'SomeClass<int>'
|
||||||
|
std::cout << NAMEOF_FULL_TYPE_EXPR(std::declval<const SomeClass<int>>()) << std::endl; // 'const SomeClass<int> &&'
|
||||||
|
|
||||||
// Nameof type.
|
// Nameof type.
|
||||||
std::cout << nameof::nameof_type<SomeClass<int>>() << std::endl; // 'SomeClass<int>'
|
std::cout << nameof::nameof_type<SomeClass<int>>() << std::endl; // 'SomeClass<int>'
|
||||||
std::cout << NAMEOF_TYPE(SomeClass<int>) << std::endl; // 'SomeClass<int>'
|
std::cout << NAMEOF_TYPE(SomeClass<int>) << std::endl; // 'SomeClass<int>'
|
||||||
std::cout << NAMEOF_TYPE(Long::LL) << std::endl; // 'Long::LL'
|
std::cout << NAMEOF_TYPE(Long::LL) << std::endl; // 'Long::LL'
|
||||||
|
std::cout << NAMEOF_FULL_TYPE(const Long::LL&) << std::endl; // 'const Long::LL &'
|
||||||
|
|
||||||
// Nameof macro.
|
// Nameof macro.
|
||||||
std::cout << NAMEOF(__LINE__) << std::endl; // '__LINE__'
|
std::cout << NAMEOF(__LINE__) << std::endl; // '__LINE__'
|
||||||
|
|
Loading…
Reference in a new issue