On Sunday, 2 October 2022 at 16:44:25 UTC, Paul Backus wrote:
It's because `writeln` is copying the object, and each of the copies is being destroyed. If you add a copy constructor to your example, you can see it happening:
...

I thought something like this could be happening in my original implementation and tried implementing a copy constructor using this reference https://dlang.org/spec/struct.html#struct-copy-constructor but it did not work. Both your's and the manual's suggestion works for my baby example but not for my actual code.

Any reason why this could be?

Reply via email to