Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-01-11 23:39:46


"Paul Mensonides" <pmenso57_at_[hidden]> writes:

> ----- Original Message -----
> From: "David Abrahams" <dave_at_[hidden]>
> To: "boost" <boost_at_[hidden]>
> Sent: Saturday, January 11, 2003 8:10 PM
> Subject: [boost] Fun, only handled by vc6/7!
>
>
>>
>> Here's an interesting turn-of-the-tables: I was experimenting with
>> using SFINAE to disable conversion operators, and I discovered that
>> almost every compiler except vc6/7 rejects this code:
>>
>> template <class T> struct voidify { typedef void type; };
>> template <class T> struct Y {};
>> struct X
>> {
>> template <class T>
>> operator Y<T> (typename voidify<T>::type) const { return Y<T>(); }
>> };
>
> Is this even legal? I.e. for a user-defined conversion operator to have any
> arguments at all?

Look twice; the argument is void.

-- 
                       David Abrahams
   dave_at_[hidden] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

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