On 10/2/22 12:21 PM, data pulverizer wrote:
>I've noticed that writeln
calls the destructor of a struct multiple times and would like to know how to stop this from happening. It has become a very serious problem when working with objects that have memory management external to D.
I know you already solved the problem, but just for future reference, if you use something like RefCounted
, you can avoid copying and destruction until everyone is done with the object. This is how my io library works, the IO objects are non-copyable, and you wrap them in RefCounted
if you want to copy them.
-Steve