diff --git a/include/nameof.hpp b/include/nameof.hpp index f269b5b..9faee3e 100644 --- a/include/nameof.hpp +++ b/include/nameof.hpp @@ -459,18 +459,17 @@ constexpr cstring Nameof(const char* name, std::size_t size, bool with_suffix = } template ::value>::type> -NAMEOF_CONSTEXPR cstring NameofEnum(T value) { + typename D = typename std::decay::type, + typename U = typename std::underlying_type::type, + typename S = typename std::is_signed::type, + typename = typename std::enable_if::value>::type> +NAMEOF_CONSTEXPR cstring NameofEnum(D value) { #if defined(__clang__) || defined(_MSC_VER) return detail::NameofPretty( - std::is_unsigned::type>::value - ? detail::NameofEnumImpl{}(static_cast(value)) - : detail::NameofEnumImpl{}(static_cast(value)), + detail::NameofEnumImpl{}(static_cast(value)), false); #elif defined(__GNUC__) - return std::is_unsigned::type>::value - ? detail::NameofEnumImpl{}(static_cast(value)) - : detail::NameofEnumImpl{}(static_cast(value)); + return detail::NameofEnumImpl{}(static_cast(value)); #else return {}; #endif @@ -497,7 +496,7 @@ constexpr cstring NameofRaw(const char* name, std::size_t size) { #define NAMEOF_RAW(...) ::nameof::NameofRaw(#__VA_ARGS__, (sizeof(#__VA_ARGS__) / sizeof(char)) - 1) // Used to obtain the simple (unqualified) string name of a enum variable. -#define NAMEOF_ENUM(...) ::nameof::NameofEnum<::std::decay::type>(__VA_ARGS__) +#define NAMEOF_ENUM(...) ::nameof::NameofEnum(__VA_ARGS__) // Used to obtain the string name of a type. #define NAMEOF_TYPE(...) ::nameof::NameofType()