Dynamic Array Question

Christophe travert at phare.normalesup.org
Tue Sep 20 14:48:10 PDT 2011


> To avoid having to change your other code, I'd do this:
> 
> wchar[] t = ...;
> scope(exit) delete t; // add this line to the end of the function (after  
> returning)
> 
> There is another way, but it's not as easy:
> 
> // put this at the top of file
> import core.memory;
> 
> ...
> 
> scope(exit) GC.free(t.ptr);

does "scope wchar[] t = ...;" work too ?


More information about the Digitalmars-d-learn mailing list