diff --git a/nameof.cpp b/nameof.cpp index bcaa77e..d5ac395 100644 --- a/nameof.cpp +++ b/nameof.cpp @@ -6,6 +6,10 @@ template const char* template_nameof_variable(const T& validate_typ #define nameof_type(name) template_nameof_type(#name) template const char* template_nameof_type(const char* name) { return name; } +///Used to obtain the string name of a function. +#define nameof_function(name) template_nameof_function(#name, sizeof(#name)/sizeof(char) - 1); (name); +const char* template_nameof_function(const char* name) { return name; } + //example int test = 0; std::cout << nameof_variable(test) << " " << nameof_type(int) << std::endl;