struct constructors and destructors.
Adam D. Ruppe via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jul 19 06:05:21 PDT 2017
On Wednesday, 19 July 2017 at 12:34:50 UTC, Stefan Koch wrote:
> Which leaves the scope after assigning.
> And therefore triggers the destructor.
No, that's not the case. There is a temporary, but its destructor
is not called. The existing object in `foo` is destroyed, so the
new one can be moved (and indeed moved, not copied, so no
postblit, no dtor call, though it might or might not invalidate
internal pointers - that's why the spec bans those) into its
place.
More information about the Digitalmars-d
mailing list