Struct copy and destruction
Morlan
home at valentimex.com
Sat Apr 9 23:21:22 PDT 2011
>> I was curious too, so found in Section 7.1.5.1 the description of
>> opAssign using a swap. That explains it I think.
Section 7.1.5.1 does not apply because it concerns the case where you define your own
overload of the assignment operator. In my example the default assignment is used.
The description of the default assignment is somewhat vague and does not ever mention
the fact that the destructor of the target is called as its byproduct. In fact, if
you add opAssign to S you will see that the destructor is not called any more. It is
probably assumed that if you define your own assignment its up to you to take care of
such details. This whole subject needs some reworking in the documentation.
More information about the Digitalmars-d
mailing list