Michael Olea wrote: > Sometimes, in an introspective mood, my code reflecting on itself, I like > to write test code that prints the results of introspection, some of which > consist of the names of Types. The problem is: typeid(T).name(), in my > usual worlds (e.g. gcc version 3.2.2 [FreeBSD] 20030205 (release)), > returns an illegible mangling or a cryptic abbreviation. For example: > > typeid(unsigned int).name() > > returns "j". And while I do appreciate the savings involved it nonetheless > irritates readers of the output - rather than "j" they would like to see > "unsigned int". Bother!
Well, if you can live with using compiler specific functionality here, then you could demangle that name. g++ uses just the same string that would be used in name mangling. Look into the cxxabi.h header. It provides a function abi::__cxa_demangle() that can convert the name returned by typeid(T).name() into what you want. xpost&f'up2 gnu.g++.help, because that group is clearly more appropriate for answers to my posting. _______________________________________________ Help-gplusplus mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-gplusplus
