Does delete ptr
differ from operator delete(ptr)
only in this, that delete
calls ptr
destructor? Or in other words, does delete ptr
first call a destructor of ptr
and then operator delete(ptr)
to free allocated memory? Then is delete ptr
technically equivalent to the following:
T * ptr = new T;
//delete ptr equivalent:
ptr->~T();
::operator delete(static_cast<void *>(ptr));
?
operator delete
. – Nelan