
8 Feb
2004
8 Feb
'04
10:20 p.m.
David Abrahams wrote:
Daniel Wallin <dalwan01@student.umu.se> 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?
Yes.
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.
I don't know, it's still cool. Maybe your version breaks less rules, or breaks the rules less? ;) I'm not familiar enough with these rules to say. -- Daniel Wallin