How are extra copy constructor parameters used?

Ali Çehreli acehreli at yahoo.com
Thu Dec 30 02:04:30 UTC 2021


On 12/29/21 5:14 PM, Paul Backus wrote:

> Therefore, when you write your own copy constructors, you should always 
> use `inout` if possible, so that compiler-generated copy constructors 
> will be able to copy instances of your struct that appear as members of 
> other structs.

Excellent point. I noticed a typo in the documentation:

struct A
{
     this(ref return scope inout A rhs) immutable {}
}

That 'immutable' should be 'inout', right?

Ali


More information about the Digitalmars-d-learn mailing list