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

Walter Bright newshound2 at digitalmars.com
Fri Mar 12 10:07:41 UTC 2021


On 3/11/2021 4:53 PM, deadalnix wrote:
> On Thursday, 11 March 2021 at 21:41:59 UTC, Walter Bright wrote:
>> Why? There can be no other uses of the rvalue, so why not simply move it?
> 
> If you have two objects in your move constructor, but only one at the end, then 
> a destruction must take place somewhere.

The whole point of move construction is to move an initialized object to an 
unconstructed object. No destruction is needed.

It's move assignment that needs to destruct something (the original value of the 
destination).


More information about the Digitalmars-d mailing list