From a65c53889cb5c298c27de3c31e40e13633ea465c Mon Sep 17 00:00:00 2001 From: Terik23 Date: Thu, 22 Mar 2018 15:01:55 +0500 Subject: [PATCH] v0.1.2 --- src/nameof.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/nameof.hpp b/src/nameof.hpp index abb8cfb..dcadab7 100644 --- a/src/nameof.hpp +++ b/src/nameof.hpp @@ -1,5 +1,5 @@ // nameof() c++ https://github.com/Terik23/Nameof -// Vesion 0.1.1 +// Vesion 0.1.2 // // Licensed under the MIT License . // Copyright(c) 2016 - 2018 Terik23 @@ -28,9 +28,10 @@ namespace nameof { -#define NAMEOF_RAW(x) (#x) +#define NAMEOF_RAW_(x) #x +#define NAMEOF_RAW(x) NAMEOF_RAW_(x) -inline constexpr const char* Nameof(const char* name, const size_t length) { +constexpr const char* Nameof(const char* name, const size_t length) { return length == 0 ? name : (name[length - 1] == ' ' || name[length - 1] == '.' || name[length - 1] == '>' || name[length - 1] == ':' || @@ -43,7 +44,7 @@ inline constexpr const char* Nameof(const char* name, const size_t length) { // Used to obtain the string name of a variable, function and etc. template -inline constexpr const char* Nameof(const char* name, const size_t length) { return Nameof(name, length); } +constexpr const char* Nameof(const char* name, const size_t length) { return Nameof(name, length); } #define NAMEOF(name) nameof::Nameof(NAMEOF_RAW(name), sizeof(NAMEOF_RAW(name)) / sizeof(char) - 1) #define NAMEOF_VARIABLE(variable) NAMEOF(variable)