Discussion Thread: DIP 1040--Copying, Moving, and Forwarding--Community Review Round 1

tsbockman thomas.bockman at gmail.com
Thu Mar 11 21:48:44 UTC 2021


On Thursday, 11 March 2021 at 10:09:25 UTC, deadalnix wrote:
> On Thursday, 11 March 2021 at 04:17:48 UTC, tsbockman wrote:
>> Also, doesn't this mean that every move of an object with a 
>> destructor requires a copy?
>
> No, only if said object was initialized first.
>
>> Does the copy constructor get  called in such cases?
>
> Why? That would not allow for the removal of the destruction, 
> in fact now you'd have 2 object to destroy instead of 1.
>
>> If so, what benefit do moves have over copies?
>
> They do not create a new object to destroy.

I have written an example to clarify what I'm asking about:
     
https://forum.dlang.org/post/igagderdongxdhvfjihj@forum.dlang.org


More information about the Digitalmars-d mailing list