char * buf = new char[sizeof(T)]; new (buf) T; T * t = (T *)buf; //code... //here I should destruct *t but as it is argument of template and can be //instantiated vi
You first destruct the object by directly calling the destructor:
t->~T();
Then you destroy the memory by calling delete[] on the pointer returned from new[]:
delete[]
new[]
delete []buf;