commit 9e76ea3771c02f19547873002c081d5bd3ea151b Author: Terik23 Date: Wed Oct 5 14:14:37 2016 +0500 diff --git a/nameofcpp b/nameofcpp new file mode 100644 index 0000000..8a93754 --- /dev/null +++ b/nameofcpp @@ -0,0 +1,13 @@ +///Used to obtain the string name of a variable. + +#define nameof(name) template_nameof((name), #name) + +template +const char* template_nameof(T test, const char* name) +{ + return name; +} + +// int test = 0; +// std::cout << nameof(test) << std::endl; +// prints "test” \ No newline at end of file