D's equivalent to C++'s std::move?

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Thu Feb 4 00:41:30 PST 2016


On Thursday, 4 February 2016 at 02:33:06 UTC, Andrei Alexandrescu 
wrote:
> Got it, thanks. That's a bug in the implementation, no two ways 
> about it. No copy should occur there, neither theoretically nor 
> practically. Please report it to bugzilla at 
> http://issues.dlang.org. Thanks very much! -- Andrei

I don't see how that point can be argued.

The language reference states:
«
a op= b
are semantically equivalent to:
a = cast(typeof(a))(a op b)
»

Therefore:

«a ~= b» should be semantically equivalent to « a =  
cast(typeof(a))(a ~ b)»

So if the language reference is correct you need copy semantics?

I hope you guys will make sure that the language reference is in 
sync with the implementation.



More information about the Digitalmars-d mailing list