Can't I allocate at descontructor?

Jack jckj33 at gmail.com
Sat Mar 6 04:29:41 UTC 2021


On Friday, 5 March 2021 at 21:25:52 UTC, Ali Çehreli wrote:
> On 3/5/21 12:57 PM, Jack wrote:
>
> >> destroy() executes the destructor.
> >
> > but I would need to call it manually and only after I
> somewhat I've
> > determined I no longer need the resources, right? so
> destroy(c) would be
> > no different from calling my own finalize-like method like
> freeResources()?
>
> Yes but perhaps with some extra functionality like the optional 
> 'initialize':
>
>   https://dlang.org/phobos/object.html#.destroy
>
> Ali

Now about the behavior of a static destructor, like static 
~this() { } is this guaranteed to be run?


More information about the Digitalmars-d-learn mailing list