Boost logo

Boost :

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


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>(); }
};
int main()
{
    X x;
    return 0;
}

You can substitute enable_if<condition,void> for voidify to see why I
care; this is just a minimal example.

Note that many of the same compilers will accept voidify<int>::type as
the argument, though!

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