|
Boost : |
From: Douglas Paul Gregor (gregod_at_[hidden])
Date: 2003-01-22 16:47:03
On Wed, 22 Jan 2003, [ISO-8859-1] Unai Uribarri Rodríguez wrote:
> Douglas Paul Gregor wrote:
> > Any particular reason why any_cast<A>(x) should return a copy and not a
> > reference?
>
> Because any_cast<A&>(x) states more clearly your intention of retrieving
> a reference.
Okay.
> I think that there are two reasonable options:
> * any_cast<A>(x) could return a copy of the content of x, or
> * any_cast<A>(x) could be illegal, as is dynamic_cast<A>(x).
I strongly prefer the first option, because it will not break existing code.
We should give the author a chance to respond (I've written to him
privately about the discussion) first; if he does not object, I think we
should apply your patch (which will need to be modified a little for
compilers that cannot handle remove_reference).
Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk