This commit is contained in:
Terik23 2018-03-17 08:12:52 +05:00 committed by GitHub
parent 37f2f3da6c
commit 53e7ce7e7f

View file

@ -22,16 +22,16 @@
///Used to obtain the string name of a variable. ///Used to obtain the string name of a variable.
#define nameof_variable(name) template_nameof_variable(name, #name) #define nameof_variable(name) template_nameof_variable(name, #name)
template <typename T> const char* template_nameof_variable(const T& validate_type, const char* name) { return name; } template <typename T> constexpr const char* template_nameof_variable(const T& validate_type, const char* name) { return name; }
///Used to obtain the string name of a type. ///Used to obtain the string name of a type.
#define nameof_type(name) template_nameof_type<name>(#name) #define nameof_type(name) template_nameof_type<name>(#name)
template <typename T> const char* template_nameof_type(const char* name) { return name; } template <typename T> constexpr const char* template_nameof_type(const char* name) { return name; }
///Used to obtain the string name of a function. ///Used to obtain the string name of a function.
#define nameof_function(name) template_nameof_function(#name); if (false) { (name) }; #define nameof_function(name) template_nameof_function(#name); if (false) { (name) };
const char* template_nameof_function(const char* name) { return name; } constexpr const char* template_nameof_function(const char* name) { return name; }
//example //example
int test = 0; int test = 0;