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]>

>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?


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