Re: opAssign() calls members' postblits?

2014-06-22 Thread via Digitalmars-d-learn
On Saturday, 21 June 2014 at 20:03:26 UTC, Ali Çehreli wrote: > Now, http://dlang.org/struct.html#AssignOverload says: > > ref S opAssign(S s) > { Note that opAssign takes by-value. The post-blits that you see are due that copy. i.e. b in main is copied to the argument that opAssign

Re: opAssign() calls members' postblits?

2014-06-21 Thread Ali Çehreli via Digitalmars-d-learn
On 06/21/2014 11:56 AM, "Marc Schütz" " wrote: > import std.stdio; > > struct A { > this(this) { > writeln("A.this(this)"); > } > > B b1, b2; > } > > struct B { > this(this) { > writeln("B.this(this)"); > }

opAssign() calls members' postblits?

2014-06-21 Thread via Digitalmars-d-learn
import std.stdio; struct A { this(this) { writeln("A.this(this)"); } B b1, b2; } struct B { this(this) { writeln("B.this(this)"); } } void main() { A a, b; a = b; } This outputs: B