From 6ae0ee00a75c5c2ed9b71a6d7ef916a5971acc33 Mon Sep 17 00:00:00 2001 From: Terik23 Date: Sat, 17 Mar 2018 08:06:04 +0500 Subject: [PATCH] --- nameof.cpp | 4 ++++ 1 file changed, 4 insertions(+) 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;