DIP 1018--The Copy Constructor--Community Review Round 1

Dru dru at notreal.com
Sat Jan 5 14:54:41 UTC 2019


> The copy constructor is generated, only if there are copy 
> constructors for some fields that need to be called. The idea 
> is that if a struct defines a copy constructor, it cannot be 
> blitted in any circumstances; the copy constructor should 
> always be used.

I offer a simpler logic:
A "default" copy constructor is always generated,
except when the user defines a constructor of the same signature.
Effectively the user can override the default.



> It cannot call it, because the constructor receives a reference 
> and you are passing an rvalue. That is not even a copy 
> constructor, but a regular constructor, so if you want the 
> compiler to call it, simply delete the ref.

yes not related to the DIP
just wondering why block the option to pass rvalue by ref




More information about the Digitalmars-d mailing list