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

maik klein via Digitalmars-d digitalmars-d at puremagic.com
Wed Feb 3 19:45:57 PST 2016


On Thursday, 4 February 2016 at 01:26:55 UTC, Andrei Alexandrescu 
wrote:
> On 02/03/2016 07:48 PM, Matt Elkins wrote:
>> This [apparent] lack of clean move semantics
>
> I very much wish there was a quick summary. I figure you've 
> seen std.algorithm.move. What's missing? -- Andrei

I am in a similar boat as Matt Elkins. The problem is not D's 
move semantics, but that Phobos does not support them at all.

I have already several things that are not copyable, one of them 
is "Unique". It feels incredibly restrictive to use those in D. 
You can not put them in Arrays, you can not put them in Tuples, 
you can not use writeln on them, you can basically not use them 
at all in Phobos because pretty much everything relies on copying.

I have currently written tons of stuff from scratch just to 
support a few non copyable types. This is probably my biggest 
complain about D so far.

It might still be the case that I am missing something obvious 
here.


More information about the Digitalmars-d mailing list