nameof_module/nameof.cpp
Terik23 0fd887fa00
2016-10-09 19:44:36 +05:00

13 lines
No EOL
295 B
C++

///Used to obtain the string name of a variable.
#define nameof(name) template_nameof((name), #name)
template <typename T>
const char* template_nameof(const T& validate_type, const char* name)
{
return name;
}
// int test = 0;
// std::cout << nameof(test) << std::endl;
// prints "test”