This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: type_info::name


> Is there a possibility to get a readable class name from type_info::name?
> With g++ I
> get
> t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b1i0.

Not really. If you slightly tweak this string, you can pass it too
c++filt:

mira% c++filt foo__t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b1i0 
basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >::foo(void)

If you then strip the '::foo(void)' part, you get the type
name. Instead of c++filt, you can also use cplus_demangle, which is a
function from -liberty.

Regards,
Martin

P.S. I'd question whether the second form is more readable than the
first one, though.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]