DIP 1018--The Copy Constructor--Formal Review

Walter Bright newshound2 at digitalmars.com
Tue Feb 26 04:07:19 UTC 2019


On 2/25/2019 3:05 PM, Olivier FAURE wrote:
> On Monday, 25 February 2019 at 22:45:38 UTC, Olivier FAURE wrote:
>> For the same reason C++'s std::shared_pointer uses a non-const copy constructor.
> 
> Wait, no, I just checked, std::shared_pointer's copy constructor is const, even 
> though it changes shared data. Ugh, that's just wrong.
> 
> (I kind of agree with Walter's point; I totally assumed the constructor would be 
> non-const, since it mutates data it receives)

There's also no requirement that any arguments to constructors should be const. 
Why should copy-constructors be different?


More information about the Digitalmars-d-announce mailing list