Copy constructors for lazy initialization

Walter Bright newshound1 at
Fri May 28 19:34:46 PDT 2010

Jonathan M Davis wrote:
> The weird thing here is that you're actually altering the parameter that you 
> passed in, which is normally a major no-no with copy constructors.


One subtle but important distinction from C++ is that D can omit copy 
construction completely if the compiler can determine there are no further uses 
of the source object, and substitute a simple bit copy. This should result in a 
fundamental performance improvement.

More information about the Digitalmars-d mailing list