3#if (defined(MAYAFLUX_COMPILER_CLANG) || defined(MAYAFLUX_COMPILER_GCC)) && !defined(MAYAFLUX_PLATFORM_WINDOWS)
13 auto pos = name.rfind(
':');
14 return (pos != std::string_view::npos) ? name.substr(pos + 1) : name;
28[[nodiscard]]
constexpr std::string_view
type_name() noexcept
30#if defined(MAYAFLUX_COMPILER_CLANG)
31 constexpr std::string_view fn = __PRETTY_FUNCTION__;
32 constexpr auto s = fn.find(
"T = ") + 4;
33 constexpr auto e = fn.rfind(
']');
34 return fn.substr(s, e - s);
35#elif defined(MAYAFLUX_COMPILER_GCC)
36 constexpr std::string_view fn = __PRETTY_FUNCTION__;
37 constexpr auto s = fn.find(
"T = ") + 4;
38 constexpr auto e = fn.find(
';', s);
39 return (e != std::string_view::npos) ? fn.substr(s, e - s) : fn.substr(s);
40#elif defined(MAYAFLUX_COMPILER_MSVC)
41 constexpr std::string_view fn = __FUNCSIG__;
42 constexpr auto s = fn.find(
"type_name<") + 10;
43 constexpr auto e = fn.rfind(
">(");
44 return (e != std::string_view::npos && e > s) ? fn.substr(s, e - s) : fn.substr(s);
77 const char* mangled =
typeid(obj).name();
78#if (defined(MAYAFLUX_COMPILER_CLANG) || defined(MAYAFLUX_COMPILER_GCC)) && !defined(MAYAFLUX_PLATFORM_WINDOWS)
80 char* buf = abi::__cxa_demangle(mangled,
nullptr,
nullptr, &status);
81 std::string result = (status == 0 && buf) ? buf : mangled;
std::string_view strip_namespaces(std::string_view name) noexcept
constexpr std::string_view type_name() noexcept
Returns the fully qualified compile-time type name of T.
constexpr std::string_view short_type_name() noexcept
Returns the unqualified compile-time type name of T.
std::string dynamic_type_name(const T &obj) noexcept
Returns the demangled fully qualified dynamic type name of obj.
std::string short_dynamic_type_name(const T &obj) noexcept
Returns the unqualified dynamic type name of obj.