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

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Sun Feb 14 06:15:36 PST 2016


On Sunday, 14 February 2016 at 14:12:09 UTC, Ola Fosheim Grøstad 
wrote:
> You can work around it by having extra pointers/containers in 
> or held by the struct (pointers to the source that is pointing 
> to you). But that takes more space.

In the not-multithreaded version. In the multithreaded version 
you would have to use a heap allocated object that does not move 
and put the mutex there.

If std.move(x) wipes out x, without checking mutexes first... 
well, that can't work well with multi-threading. I guess you 
could avoid using std.move(x) and use a different function, but 
how do you ensure that?




More information about the Digitalmars-d mailing list