Possible Duplicate:
Destructors of builtin types (int, char etc..)
Template Function:
template<typename T> void kill(T* type)
{
type->~T();
}
Call:
int x= 5;
kill(&x);
woah, it compiled!? How can a primitive type like int
have a destructor? It is also working with char
, bool
etc.