On Fri, Apr 25, 2014 at 12:26 AM, Klaim - Joël Lamotte
On Sun, Apr 20, 2014 at 8:14 PM, Niall Douglas
wrote: I was wondering though: - what is the behaviours of pretty_name() when the type is in namespaces (there are no example of this); - what is the behaviours of pretty_name() when the type is in an anonymous namespace?
I had similar questions reading the doc as well. Or the name of a template full specialization? But what bothered me a little was the note about the fact that pretty_name() was not consistent across platforms/compilers. This means you can't depend on it for generating a type-name-based factory registration via a template taking the type to be instantiated, and deducing the registration name from the type, in a way that will be cross-compiler or cross-platform, w/o some kind of post-processing to remove possible struct/class prefix, or namespace prefix if desired. It's only a problem when the names are coming at runtime from external strings, but that's a common enough use-case of factories, to want boost::typeindex to support it, no? Thus I'd request a safe_name() / consistent_name() method, that does the pretty_name() post-processing once and for all, to yield ns_name::type_name for example, or perhaps even a std::pair with NS name as .first, and type name as .second. Thanks, --DD