Manual memory management in D2

bearophile bearophileHUGS at
Sun Jul 11 11:29:40 PDT 2010

Simen kjaeraas:

> Petr:
>> What would happen if i skipped clear()?
> Then your destructors wouldn't get called. takes a humble void
> pointer, which knows little of destructors and other such fancy things.
> If you feel unsure you will remember, feel free to use this function:
> void destroy( T )( T obj ) if ( is( T == class ) ) {
>      clear( obj );
> obj );
> }

That can be a good thing to add to Phobos2 or the core. An overloaded version with the same name for nonclasses can be added.


More information about the Digitalmars-d mailing list