Copy Constructor DIP

sclytrack fake at hotmail.com
Sun Jul 15 14:27:32 UTC 2018


On Friday, 13 July 2018 at 11:02:57 UTC, RazvanN wrote:
>>> [...]
>
> Indeed, but this was the source of the problem also, because 
> you could
> modify immutable fields that way.
>
>>> [...]
>>
>> Affirmative. The DIP needs to specify how assignment is 
>> handled if no opAssign is present but a copy ctor is present. 
>> Thanks!
>
> The difference between a copy constructor and opAssign is how 
> the type checking
> is performed. This leads to situations where a copy constructor 
> is not suitable as an assignment operator. However, if a copy

...

> What are your opinions on this?

What about going the other way?

Can you use the unqualified opAssign as the unqualified copy 
constructor?

I assume these @implicit copy constructors are normal 
constructors.







More information about the Digitalmars-d mailing list