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

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Mon Feb 1 05:52:49 PST 2016


On Monday, 1 February 2016 at 13:21:02 UTC, Shachar Shemesh wrote:
> q = std::move(p);
>
> I am unsure what is the correct way to do this under D.

Note that C++ std::move(...) doesn't do anything related to 
state, it is only a type cast, so it is zero-overhead.

What I have done to get semantics close to C++ is to define 
"moving" type and a "pointer" type that use it.

(I dislike how D deals with this.)



More information about the Digitalmars-d mailing list