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

Elronnd elronnd at elronnd.net
Thu Mar 18 06:14:10 UTC 2021


> If a Move Constructor is not defined for a struct that has a 
> Move Assignment Operator, a default Move Constructor is defined 
> and implemented as a move for each of its fields, in lexical 
> order.

I think the order should be undefined.  Forcing the moves to 
happen in lexical order may inhibit some optimizations; and code 
which relies on the order of implicit moves is fragile anyway and 
shouldn't be encouraged.  If the order is important for 
legitimate reasons, then those reasons should be made explicit in 
the code with an explicit move constructor.


More information about the Digitalmars-d mailing list