Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2005-03-26 05:53:27


> if
> static From _m_from;
> is replaced by
> static const From& make_from();
>
> it'll work with abstract types

That would stop working for reference types.

However this change is already unnecessary: an add_reference is applied
before the code gets that far, so abstract types *are* allowed as the "From"
parameter, and have been for some time (as are other tricky things like
function types), and this is currently tested in our test suite.

It's when the "To" parameter is an abstract type that things get tricky, and
as I said, this is also fixed in current cvs: provided your compiler
supports is_abstract.

The remaining issue, is that there is no way to tell whether a
converting-constructor is accessible or not, so if the "To" type has a
private converting constructor that accepts the "From" type, then the result
is that is_convertible produces a compiler error. As far as anyone knows
there is no way around that - feel free to consider that a challenge if you
like :-)

John.


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