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