clean-up nameof_type_impl()
This commit is contained in:
parent
c99f0a4e40
commit
50ded04922
1 changed files with 3 additions and 7 deletions
|
@ -201,18 +201,14 @@ template <typename E, int O, int... I>
|
||||||
template <typename... T>
|
template <typename... T>
|
||||||
[[nodiscard]] constexpr std::string_view nameof_type_impl() noexcept {
|
[[nodiscard]] constexpr std::string_view nameof_type_impl() noexcept {
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
std::string_view name{__PRETTY_FUNCTION__ + 83, sizeof(__PRETTY_FUNCTION__) - 87};
|
return {__PRETTY_FUNCTION__ + 83, sizeof(__PRETTY_FUNCTION__) - 87 - (__PRETTY_FUNCTION__[sizeof(__PRETTY_FUNCTION__) - 5] == ' ' ? 1 : 0)};
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
std::string_view name{__PRETTY_FUNCTION__ + 98, sizeof(__PRETTY_FUNCTION__) - 151};
|
return {__PRETTY_FUNCTION__ + 98, sizeof(__PRETTY_FUNCTION__) - 151 - (__PRETTY_FUNCTION__[sizeof(__PRETTY_FUNCTION__) - 54] == ' ' ? 1 : 0)};
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
std::string_view name{__FUNCSIG__ + 139, sizeof(__FUNCSIG__) - 157};
|
return {__FUNCSIG__ + 139, sizeof(__FUNCSIG__) - 157 - (__FUNCSIG__[sizeof(__FUNCSIG__) - 19] == ' ' ? 1 : 0)};
|
||||||
#else
|
#else
|
||||||
return {}; // Unsupported compiler.
|
return {}; // Unsupported compiler.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__clang__) || defined(__GNUC__) || defined(_MSC_VER)
|
|
||||||
return name.substr(0, name.length() - (name.back() == ' ' ? 1 : 0));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace nameof::detail
|
} // namespace nameof::detail
|
||||||
|
|
Loading…
Reference in a new issue