|
Boost : |
From: Daniel Wallin (dalwan01_at_[hidden])
Date: 2004-02-09 05:40:24
Daniel Frey wrote:
> David Abrahams wrote:
>> Oh, really? Too bad; I guess this isn't really much of an innovation
>> then.
>
>
> Maybe I misunderstood what you have done, but to me this was the most
> important part of your code! No strange changes for the user like
> returning special values from functions
I believe this is still needed, for the same reason as in Mojo.
> (which is BTW breaking RVO/NRVO
> and which is what I never liked about Mojo...) and no need for special
> function signatures as in Mojo, where you had to declare function in a
> certain unnatural style. IIRC, something like:
>
> void f( X& );
> void f( mojo::temporary< X >& );
> void f( mojo::constant< X >& );
You only need to do that if you want an rvalue reference as a parameter.
Normally you would just take the parameter by value and trust the move
constructor. The same thing needs to be done with Dave's version and
also with some future addition of rvalue-references to C++.
void f(X); // can move automatically with move constructor
// in both Andrei's and Dave's code
void f(mojo::temporary<X> x); // rvalue ref in Andrei's code
void f(X::ref x); // rvalue ref in Dave's code
-- Daniel Wallin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk