On 07/22/2012 01:46 AM, Namespace wrote: > Oh yes, i mean std.typecons, not std.algorithm, my bad. > > If delete will be deprecated, how can i delete/call dtor of one of my > objects manually?
In C++, deleting involves two steps: call the destructor and release the memory.
It is different in D: releasing memory should be the responsibility of the GC; after all, GC is the one that runs some algorithm that fits its needs.
On the other hand, calling the destructor is still acceptable in D because it may be important for the programmer to run the contents earlier than GC would. clear() does that:
auto t = new Test(f3); // ... clear(t); // <-- Run the destructor Unfortunately it has a bad name, which is going to be changed. Ali