On Thursday, 23 November 2017 at 15:45:17 UTC, Rene Zwanenburg wrote:
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.

Wow, that's great! Thanks for the clarification you two!

For reference:
https://dlang.org/spec/struct.html#struct-postblit
http://ddili.org/ders/d.en/special_functions.html

Reply via email to