From 07696f969a2b8ef0b2a32f6eda7faf51d1ef668d Mon Sep 17 00:00:00 2001 From: terik23 Date: Sun, 28 Apr 2019 14:15:42 +0500 Subject: [PATCH] clean-up --- include/nameof.hpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/include/nameof.hpp b/include/nameof.hpp index 0435abf..e5395ce 100644 --- a/include/nameof.hpp +++ b/include/nameof.hpp @@ -72,17 +72,11 @@ struct identity final { template [[nodiscard]] constexpr std::string_view nameof_type_impl() noexcept { #if defined(__clang__) - constexpr auto prefix = sizeof("std::string_view nameof::detail::nameof_type_impl() [T = >]") - 1; - constexpr std::string_view name{__PRETTY_FUNCTION__ + prefix, sizeof(__PRETTY_FUNCTION__) - prefix - suffix - 1}; + constexpr std::string_view name{__PRETTY_FUNCTION__ + 83, sizeof(__PRETTY_FUNCTION__) - 87}; #elif defined(__GNUC__) - constexpr auto prefix = sizeof("constexpr std::string_view nameof::detail::nameof_type_impl() [with T = {nameof::detail::identity<") - 1; - constexpr auto suffix = sizeof(">}; std::string_view = std::basic_string_view]") - 1; - constexpr std::string_view name{__PRETTY_FUNCTION__ + prefix, sizeof(__PRETTY_FUNCTION__) - prefix - suffix - 1}; + constexpr std::string_view name{__PRETTY_FUNCTION__ + 98, sizeof(__PRETTY_FUNCTION__) - 151}; #elif defined(_MSC_VER) - constexpr auto prefix = sizeof("class std::basic_string_view > __cdecl nameof::detail::nameof_type_impl>(void) noexcept") - 1; - constexpr std::string_view name{__FUNCSIG__ + prefix, sizeof(__FUNCSIG__) - prefix - suffix - 1}; + constexpr std::string_view name{__FUNCSIG__ + 139, sizeof(__FUNCSIG__) - 157}; #else return {}; // Unsupported compiler. #endif @@ -217,6 +211,7 @@ template template [[nodiscard]] constexpr std::string_view nameof_raw_impl(std::string_view name) noexcept { static_assert(std::is_void_v, "nameof::detail::nameof_raw_impl requires void type."); + return name; }