26 #ifndef GUL14_TYPE_NAME_H_
27 #define GUL14_TYPE_NAME_H_
97 auto s =
string_view{
static_cast<const char*
>(__PRETTY_FUNCTION__) };
98 auto const start_idx = s.find(
" = ") + 3;
99 s.remove_prefix(start_idx);
101 auto const colon_idx = s.find(
";");
102 auto const suff_length =
103 (colon_idx != string_view::npos) ? s.length() - colon_idx : 1;
104 s.remove_suffix(suff_length);
106 #elif defined(_MSC_VER)
109 auto const start_idx = s.find(
"gul14::type_name<") +
sizeof(
"gul14::type_name<") - 1;
110 s.remove_prefix(start_idx);
112 for (
auto end_idx = s.length() - 1; end_idx; --end_idx) {
113 if (s[end_idx] !=
'>')
115 s.remove_suffix(s.length() - end_idx);
A helper class to debug types.
Definition: type_name.h:66
constexpr string_view type_name()
Generate a human readable string describing a type.
Definition: type_name.h:92
Definition of macros used internally by GUL.
Namespace gul14 contains all functions and classes of the General Utility Library.
Definition: doxygen.h:26
Provides a gul14::string_view that is fully compatible with C++17's std::string_view.