Copy Constructor DIP

Atila Neves atila.neves at gmail.com
Thu Jul 12 13:49:10 UTC 2018


On Thursday, 12 July 2018 at 06:54:37 UTC, RazvanN wrote:

> [...]

> If by "come in pairs" you mean that you can define them both, 
> then yes,
> that is the case. Will add a paragraph in the DIP to specify 
> this.
>
> You mentioned that it's terrible that the assignment operator
> and the copy constructor come in pairs. Why is that? Would you 
> rather
> have a copy constructor that is used also as an assignment 
> operator?

Because, like in C++, now you have to implement both and make 
sure they do the same thing. Boilerplaty and a recipe for 
disaster.

Atila




More information about the Digitalmars-d mailing list