15 #if defined(__GNUC__) || defined(__clang__)
26 namespace seqan3::detail
43 template <
typename type>
44 inline std::string
const type_name_as_string = [] ()
46 std::string demangled_name{};
47 #if defined(__GNUC__) || defined(__clang__)
48 using safe_ptr_t = std::unique_ptr<char, std::function<void(
char *)>>;
52 safe_ptr_t demangled_name_ptr{abi::__cxa_demangle(
typeid(type).name(), 0, 0, &status),
53 [] (
char * name_ptr) { free(name_ptr); }};
59 return std::string{
typeid(type).name()} +
60 " (abi::__cxa_demangle error status (" + std::to_string(status) +
"): " +
61 (status == -1 ?
"A memory allocation failure occurred." :
62 (status == -2 ?
"mangled_name is not a valid name under the C++ ABI mangling rules." :
63 (status == -3 ?
"One of the arguments is invalid." :
"Unknown Error"))) +
")";
66 demangled_name = std::string{std::addressof(*demangled_name_ptr)};
68 demangled_name =
typeid(type).name();
71 if constexpr (std::is_const_v<std::remove_reference_t<type>>)
72 demangled_name += " const";
73 if constexpr (
std::is_lvalue_reference_v<type>)
74 demangled_name += " &";
75 if constexpr (
std::is_rvalue_reference_v<type>)
76 demangled_name += " &&";
78 return demangled_name;
Provides C++20 additions to the <memory> header.
SeqAn specific customisations in the standard namespace.
Definition: affine_cell_proxy.hpp:438