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

maik klein via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 2 13:18:27 PST 2016


On Monday, 1 February 2016 at 13:52:49 UTC, Ola Fosheim Grøstad 
wrote:
> 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.)

Could you share this? I would be very interested in how you have 
approached it.




More information about the Digitalmars-d mailing list