From b8a4091fdc6158e0c004683f47fa614479c3dd95 Mon Sep 17 00:00:00 2001 From: Terik23 Date: Sat, 17 Mar 2018 14:53:17 +0500 Subject: [PATCH] Fix template_nameof_variable --- src/nameof.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/nameof.hpp b/src/nameof.hpp index 4e24da9..2d11d8f 100644 --- a/src/nameof.hpp +++ b/src/nameof.hpp @@ -43,9 +43,13 @@ inline constexpr const char* template_nameof(const char* name, const size_t leng #define NAMEOF(x) #x // Used to obtain the string name of a variable. -#define NAMEOF_VARIABLE(variable) template_nameof_variable(#variable, sizeof(#variable) / sizeof(char) - 1) +#define NAMEOF_VARIABLE(variable) template_nameof_variable(variable, #variable, sizeof(#variable) / sizeof(char) - 1) template -inline constexpr const char* template_nameof_variable(const char* name, const size_t length) { return template_nameof(name, length); } +inline constexpr const char* template_nameof_variable(const T& variable, const char* name, const size_t length) { return template_nameof(name, length); } +template +inline constexpr const char* template_nameof_variable(const T* const variable, const char* name, const size_t length) { return template_nameof(name, length); } +template +inline constexpr const char* template_nameof_variable(T&& variable, const char* name, const size_t length) { return template_nameof(name, length); } #define NAMEOF_VAR(var) NAMEOF_VARIABLE(var) // Used to obtain the string name of a type.