Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2004-02-09 04:51:08


David Abrahams wrote:
> Daniel Wallin <dalwan01_at_[hidden]> writes:
>
>>With Mojo you would do something like:
>>
>> struct X : moveable<X>
>> {
>> X(X&);
>> X(constant_ref<X>);
>> X(rvalue_ref<X>); // move constructor
>> };
>>
>>And it would always move from rvalues.
>
> Meaning that you could pass an X rvalue by-value to an X parameter
> without any deep copying?
>
>>The intrusive part was that to
>>solve the whole "binding rvalues to const&" problem you needed to return
>>some special wrapper type:
>>
>> moved<X> f();
>
> 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 (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 >& );

This is now solved as your version is a true optimization, an
implementation detail of the class with no need for the user to care
about it.

Regards, Daniel

-- 
Daniel Frey
aixigo AG - financial solutions & technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de

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