This commit is contained in:
Terik23 2018-03-17 08:16:28 +05:00 committed by GitHub
parent 53e7ce7e7f
commit dfc4677bd7

View file

@ -21,16 +21,16 @@
//SOFTWARE. //SOFTWARE.
///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(variable) template_nameof_variable(variable, #variable)
template <typename T> constexpr 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(typ) template_nameof_type<typ>(#typ)
template <typename T> constexpr 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(function) template_nameof_function(#function); if (false) (void)(function);
constexpr const char* template_nameof_function(const char* name) { return name; } constexpr const char* template_nameof_function(const char* name) { return name; }
//example //example