Boost logo

Boost :

Subject: Re: [boost] is_convertible problems associated with move-only types
From: John Maddock (john_at_[hidden])
Date: 2009-01-07 05:09:38


Howard,

I believe there are a number of issues with the approach you're using:

The trivial case is that if From is not default constructible then you're
code won't compile.

More seriously there are some types which is_convertible currently works
with that *can never be rvalues*, examples include function types and
abstract classes: the latter in particular was the subject of several bug
reports until we "fixed" it with the current implementation. Basically I
think we're kind of painted into a corner here implementation wise :-(

Also the example you give is is_convertible<Movable, Movable>, is this the
real use case? I ask because any is_convertible<T, T> expression is
basically useless in C++03: it wil either compile and return true, or not
compile at all, so you may just as well replace the expression with "true"
and let the code fail later if the type is not copyable/movable :-(

So yes, I would *love* to fix this, I just don't see how at present... John.


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