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

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


On Thursday, 4 February 2016 at 03:52:23 UTC, rsw0x wrote:
> On Thursday, 4 February 2016 at 03:45:57 UTC, maik klein wrote:
>> On Thursday, 4 February 2016 at 01:26:55 UTC, Andrei 
>> Alexandrescu wrote:
>>> [...]
>>
>> 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.
>
> Those are intended not to be copied, they must be explicitly 
> moved with std.algorithm's move

I don't understand what you are saying. Are you saying that I can 
use them with Arrays, Tuples etc and I just have to use move 
somehow? If that is the case please show me because I have 
already wasted a lot of time into recreating Array, Tuple etc.

Or are you saying that I they are not compatible with Phobos?


More information about the Digitalmars-d mailing list