copy constructors need documentation

John Colvin john.loughran.colvin at gmail.com
Tue Aug 6 16:32:46 UTC 2019


On Tuesday, 6 August 2019 at 16:20:24 UTC, Olivier FAURE wrote:
> On Tuesday, 6 August 2019 at 09:42:09 UTC, John Colvin wrote:
>> Can you not just write trivial constructors (or no 
>> constructor, if struct literals are good enough for the case 
>> in question) and then use factory functions if you want 
>> behaviour like that?
>
> Let met try it...
>
> Oh yeah, actually you can. D even does return value copy 
> elision and everything.

In combination with D's "private means module-private" you can 
initialise immutable private members this way, so I'd say you're 
sorted.


More information about the Digitalmars-d mailing list