type_info::name question

Todd Vierling tv@pobox.com
Mon Sep 14 11:02:00 GMT 1998


On Mon, 14 Sep 1998, Ryszard Kabatek wrote:

: Is there any possibility to get the class name from type_info::name?
: 
: For typeid(string).name() I get:
: 't12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b1i0'.

This is the mangled name of the fully qualified class "string".  If you add
two underscores (three on platforms that need leading underscores) and run
it through c++filt, you get something useable, but it still won't say
"string"--it cannot in this case, since string is a template.

The name is mangled such that it is machine-useable.  The output of
typeinfo::name() isn't guaranteed to be human-readable.

-- 
-- Todd Vierling (Personal tv@pobox.com; Bus. todd_vierling@xn.xerox.com)




More information about the Gcc mailing list