Boost logo

Boost :

Subject: Re: [boost] [Boost-users] [typeindex v3.0] Peer review begins Mon 21st ends Wed 30th
From: Dominique Devienne (ddevienne_at_[hidden])
Date: 2014-04-25 03:25:45


On Fri, Apr 25, 2014 at 12:26 AM, Klaim - Joël Lamotte
<mjklaim_at_[hidden]> wrote:
> On Sun, Apr 20, 2014 at 8:14 PM, Niall Douglas <s_sourceforge_at_[hidden]>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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk