Boost logo

Boost :

From: John Maddock (john_maddock_at_[hidden])
Date: 2002-05-10 05:37:12


> Ok after looking at the implementation(Yes I should have done this inthe
first
> place) here is my next shot.
>
> IIUC the problem is that there is an conversion "template <class T> A(A<T>
> const&);" and thats what is_convertible can detect.
>
> It does _not_ detect whether it is actually usable, as it does not
instantiate
> it.

Yes, is_convertible only detects whether a type is *declared* as being
convertible from one type to another: and in this case it is isn't it? It
does not consider whether the implementation of the conversion contains
legal code. Consider what would happen if template class A were declared as
exported - in this case is_convertible would only have access to the
declaration of the template and not the implementation in any case.
Alternatively those compilers that instantiate templates at link time would
also necessarily ignore the conversion implementation, and look only at the
declaration. IMO is_convertible is doing the right thing.

John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/index.htm


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