27 #include <string_view>
34 template <std::size_t...Idxs>
37 return std::array{
str[Idxs]...,
'\n'};
43 #if defined(__clang__)
44 constexpr
auto prefix = std::string_view{
"[T = "};
45 constexpr
auto suffix = std::string_view{
"]"};
46 constexpr
auto function = std::string_view{__PRETTY_FUNCTION__};
47 #elif defined(__GNUC__)
48 constexpr
auto prefix = std::string_view{
"with T = "};
49 constexpr
auto suffix = std::string_view{
"]"};
50 constexpr
auto function = std::string_view{__PRETTY_FUNCTION__};
51 #elif defined(_MSC_VER)
52 constexpr
auto prefix = std::string_view{
"type_name_array<"};
53 constexpr
auto suffix = std::string_view{
">(void)"};
54 constexpr
auto function = std::string_view{__FUNCSIG__};
56 # error Unsupported compiler
59 constexpr
auto start =
function.find(prefix) + prefix.size();
60 constexpr
auto end =
function.rfind(suffix);
62 static_assert(start < end);
64 constexpr
auto name =
function.substr(start, (end - start));
71 static inline constexpr
auto value = type_name_array<T>();
78 return std::string_view{
value.data(),
value.size()};