How do I do placement delete in D?

Craig Black craigblack2 at cox.net
Tue Dec 14 12:33:26 PST 2010


"Steven Schveighoffer" <schveiguy at yahoo.com> wrote in message 
news:op.vnpz6ob6eav7ka at steve-laptop...
> On Tue, 14 Dec 2010 15:18:32 -0500, Craig Black <craigblack2 at cox.net> 
> wrote:
>
>> I know emplace is used to do placement new.  What is the equivalent 
>> placement delete?
>
> x = emplace(yourAllocationFunction!T());
>
> ...
>
> clear(x);
> yourDeallocationFunction(x); // if necessary.  For instance, stack data 
> doesn't need to be deallocated
>
> -Steve

Is there a way to explicitly invoke a struct destructor without doing an 
explicit delete?

-Craig 



More information about the Digitalmars-d mailing list