How do I do placement delete in D?

Stanislav Blinov blinov at loniir.ru
Wed Dec 15 09:46:34 PST 2010


15.12.2010 0:05, Craig Black пишет:
> Thanks Steve.  clear seems to be calling the destructor twice.  Is 
> this intentional?
>
> -Craig
>
AFAIR, it's not 'clear()' that calls destructor twice. Some time ago, 
there has been discussion on how to properly implement clear(). Initial 
implementation calls dtor, then calls default ctor to leave the object 
in a meaningful state for the GC to consume. Therefore, when object is 
being collected, dtor gets called for a second time. The discussion 
ended on the proposal of nullifying objec't vtbl instead of calling 
default ctor, which will obviate the need of a second dtor call, but I 
think this is not currently implemented.


More information about the Digitalmars-d mailing list