Copy Constructor DIP

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Jul 12 13:48:04 UTC 2018


On 07/11/2018 05:28 PM, Manu wrote:
> What's wrong with:
> struct S {
>    this(ref S copyFrom);
> }
> 
> That looks like a perfectly good copy constructor declaration ;)
> I'm just saying, the DIP needs to explain this.

Thanks, worth a paragraph discussing silent semantics change.

> Right. This is all obvious and intuitive.
> What I'm hearing is that under this proposal, copy constructors and
> assignment operators DO come in pairs (just like in C++), but that's
> not mentioned here in this DIP. Since this proposal will introduce
> that recommended pattern from C++, it may be worth mentioning.

Shouldn't hurt to add 1-2 sentences to the effect. (Also an example.)



More information about the Digitalmars-d mailing list