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

deadalnix deadalnix at gmail.com
Fri Mar 12 12:38:07 UTC 2021


On Friday, 12 March 2021 at 10:07:41 UTC, Walter Bright wrote:
> 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).

How do you ensures that there aren't any leftover that need to be 
destroyed or enforce that there are no leftovers? Enforcing it 
seems like an impossible task to be, or at least extremely 
complex. So that means you need to call the destructor anyways 
and that forces the struct to have a null state.


More information about the Digitalmars-d mailing list