Boost logo

Boost :

Subject: Re: [boost] [TypeIndex] Peer review period for library acceptance begins, ending Thurs 21st Nov
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2013-11-15 11:12:47


2013/11/15 pfultz2 <pfultz2_at_[hidden]>

> > Unfortunately, boost::type_info must derive from std::type_info for
> compatibility reasons.
>
> It sounds like you just want to extend the functionality of
> `std::type_info`. Why not make `pretty_name()` a free function that accepts
> `std::type_info`? Also, an additional `compare_type_info()` function could
> be added as well to compare types portably. Plus, it would avoid the issues
> with using strange hacks that border on undefined behavior.
>

This may be useful, thou it can be achieved in other way:

boost::type_index(var.get_type_info()).pretty_name();
boost::type_index(var1.get_type_info()) == var2.get_type_info();

> > * users want to use Boost without RTTI and fail
>
> Additionally, `boost::type_info` could be a typedef to `std::type_info`
> when
> rtti is enabled and then to some internal type to manage type info when
> rtti
> is disabled.

Andrey Semashev already suggested something like this:

#if HAS_RTTI
typedef std::type_info type_info;
#else
typedef boost::template_info type_info;
#endif

This is possibly what must be done, thanks for pointing that out once more.

-- 
Best regards,
Antony Polukhin

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