From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-02-17 07:20:15
Alexander Nasonov wrote:
> Stefan Slapeta wrote:
>> I'm very in favor of this. It has been proposed multiple times and
>> Kevlin once told me he is going to extend any_cast this way, but it
>> seems he is too busy.
> Reviewing a small patch usually takes less time then writing it. Has
> anybody with a patch contacted him?
> If not, I can do this. Here's the patch:
Given that overall reaction is positive, I'll make the change, starting with
the 'cast to reference' logic I wanted in the first place.
The only difference between my version and the one you mention above is this
snippet in 'any_cast':
// Please use BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION macro
// to generate specialization of remove_reference for your class
// See type traits library documentation for details
It looks to me that this assert will always be triggered when your pass
reference type and BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION is defined,
right? The assert will fire even if used has specialized remove_reference,
no? If that's true, the comment is not correct and casting to reference is
just not supported for broken compilers.
I see that your patch also:
1. Strips cv-qualification in constructor (which is reasonable).
2. Strips cv-qualification when casting to pointer.
Why the second aspect is needed?