D's equivalent to C++'s std::move?
rsw0x via Digitalmars-d
digitalmars-d at puremagic.com
Sat Feb 13 12:39:22 PST 2016
On Saturday, 13 February 2016 at 20:24:12 UTC, Ola Fosheim
Grøstad wrote:
> On Saturday, 13 February 2016 at 20:11:45 UTC, rsw0x wrote:
>> D "guarantees" NRVO which is what enables its move semantics,
>> C++ did/does not.
>>
>> Quotes because IIRC(?) it used to be part of the spec and it
>> isn't anymore, I don't think Walter or Andrei have addressed
>> this yet so I'm not sure if it's intended.
>
> By NRVO I assume you mean:
>
> https://en.wikipedia.org/wiki/Return_value_optimization
>
> All the common C++ compilers do RVO, but you don't need that to
> implement move semantic-like behaviour in C++03.
>
> I wouldn't call RVO move semantics at all...
It's not move semantics, it enables move semantics.
Yes, C++ compilers do it(Walter 'invented' it, fyi) but C++
doesn't guarantee it. D (is supposed) to) guarantee it, which
enables move semantics.
i.e, see https://issues.dlang.org/show_bug.cgi?id=5777
More information about the Digitalmars-d
mailing list