this(this) / opAssign

monarch_dodra monarchdodra at gmail.com
Thu Jan 10 15:49:39 PST 2013


On Thursday, 10 January 2013 at 23:37:14 UTC, Namespace wrote:
> Without a declared opAssign, this
>
>   S s3;
>   s3 = s1;
>
> also calls the postblit. That is strange.

If there is no user declared opAssign, then opAssign is 
implemented in terms of postblit. It's designed that way.

This is kind of like C++'s copy and swap idiom, but built into 
the language.


More information about the Digitalmars-d-learn mailing list