Boost logo

Boost :

From: John Maddock (john_maddock_at_[hidden])
Date: 2003-04-27 06:14:16


> Actually, there is another advantage, which (I think) is at least as
> important as the ones you cite. Namely, it is possible to define a built
> in operator such that is_convertible<Y,X> returns false for
>
> class X{};
> class Y : X {};
>
> and ambiguous conversion cases that (as far as I can tell) cannot be
> implemented in pure C++ (or even with any existing extension of which I am
> aware). That means there's no reason for any ill-formed is_convertible
> expressions, other than those involving incomplete types. That seems a
> good enough reason by itself to reject the template in favor of a built in
> operator.
>
> Put another way, the whole point of is_convertible (as I understand it) is
> to test a certain property of two types (or a type and an expression, if
> you like). In order to perform the test, it should not be necessary to
> know whether or not the types or expressions in question satisfy some
other
> untestible properties.

The problem is that the question "is A convertible to B" has four answers:
yes, no, ill-formed, and ambiguous :-(

John.

> Any code using the existing template could easily be converted to use a
> built in operator. We gain (at least) three distinct and compelling
> advantages, and it appears as though we loose nothing. Apart from getting
> it standardized, what's the problem?


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