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
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
On Thursday, 23 November 2017 at 15:26:03 UTC, Timoses wrote:
A member;
this(A a)
{
this.member = a; // specifically aiming towards this
assignment...
That's not assignment, that's construction.
opAssign is only called when you assign over a struct object that
already e
What am I missing?
import std.stdio;
struct A
{
int value;
A opAssign(A a)
{
writeln(" Assigning");
return this; // I know this makes little
sense, just for illustration
}
}
class B
{
A member;
this(A a)
{
this.member = a; // s