Copy constructors for lazy initialization

Walter Bright newshound1 at digitalmars.com
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.

Yup.

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