Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2002-11-22 12:29:04


On Fri, 22 Nov 2002 13:48:01 +0200, "Peter Dimov" <pdimov_at_[hidden]>
wrote:

>From: "David Abrahams" <dave_at_[hidden]>
>>
>> Here's what I think might be a correct implementation:
>>
>> template <class T, class U> T implicit_cast(U const& x) { return x; }
>> template <class T, class U> T implicit_cast(U& x) { return x; }
>
>The correct implementation IIRC is
>
>template<class T> T implicit_cast(typename identity<T>::type x) { return
>x; }

Nice. I'm curious: besides preventing a call to implicit_cast without
an explicit specification of the destination type, is there any other
reason why identity<> is used?

Genny.


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