The template & lt; The class T>
The inline void destroy (T * pointer)
{
Pointer - & gt; ~ (T);
}
When T is int, such as:
Int * PTR=new int.
Destroy (PTR);
So you can compile and direct PTR - & gt; ~ the int (); Just an error,
This is why ah, seek advice,
CodePudding user response:
The destructor is generally not directly callThe template & lt; The class T>
The inline void destroy (T * pointer)
{
Delete the pointer;
}
CodePudding user response:
The placement of new,