Boost logo

Boost :

Subject: Re: [boost] Is there interest in typeid(TYPE).name() like function that does not require RTTI
From: Nevin Liber (nevin_at_[hidden])
Date: 2012-05-30 14:10:47

On 29 May 2012 14:29, Antony Polukhin <antoshkka_at_[hidden]> wrote:

> Would be there some interest in function for getting class name without

To be clear, this does not do the same thing as RTTI. For instance:

struct B { virtual ~B() {} };
struct D : B {};
// ...
D d;
B& b(d);
std::cout << template_type(b) << std::endl;

will print B, not D.

That being said, this is mighty useful, especially when doing non-trivial
things with templates.

Now, I'd rather the interface return some kind of range, as there are many
times I don't want to pay the allocation cost for putting it in a string.

 Nevin ":-)" Liber  <mailto:nevin_at_[hidden]>  (847) 691-1404

Boost list run by bdawes at, gregod at, cpdaniel at, john at