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

Walter Bright newshound2 at digitalmars.com
Sat Mar 20 08:01:33 UTC 2021


The Move Constructor is defined as:

     this(S s) { ... } // move constructor

It's been pointed out (not sure which post) that this conflicts with an Rvalue 
Constructor, which has the same syntax:

     this(S s) { ... } // rvalue constructor

Note that an Rvalue Constructor is *not* considered to be a Copy Constructor:

     this(ref S s) { ... } // copy constructor

So the syntax is already in use. Need to resolve the conflict.

---------

The Rvalue Constructor and Copy Constructor are currently not allowed to coexist:

     this(S);
     this(ref S); // error, can't have both an rvalue and copy constructor

which suggests a straightforward resolution: it's an Rvalue Constructor if 
there's no Copy Constructor, and a Move Constructor if there is.

While this sounds confusing, I suspect in practice the MC is simply a more 
advanced RC.


More information about the Digitalmars-d mailing list