DIP 1018--The Copy Constructor--Formal Review

Olivier FAURE couteaubleu at gmail.com
Sun Mar 3 16:08:22 UTC 2019


On Thursday, 28 February 2019 at 01:42:13 UTC, Andrei 
Alexandrescu wrote:
> Such sharing of resources across objects is a common 
> occurrence, which would be impeded by forcing `const` on the 
> right-hand side of a copy. (An inferior workaround would be to 
> selectively cast `const` away inside the copy constructor, 
> which is obviously undesirable.) For that reason this DIP 
> proposes allowing mutable copy sources.

There's an argument to be made that a copy constructor isn't the 
best way to share resources between two variables in a way that 
might affect code using the variable being copied.


More information about the Digitalmars-d-announce mailing list