opAssign for most struct assignment calls not executed
Rene Zwanenburg
renezwanenburg at gmail.com
Thu Nov 23 15:45:17 UTC 2017
On Thursday, 23 November 2017 at 15:26:03 UTC, Timoses wrote:
> A aaa = a;
That's initialization, not assignment, which is subtly different.
It will call the postblit on aaa instead of opAssign. A postblit
can be defined this way:
this(this)
{
}
There is no way to access the original a from the postblit. All
fields have already been copied, you can use it to duplicate
reference types, increment reference counts, and other things
like that.
More information about the Digitalmars-d-learn
mailing list