delete ptr
不同之处operator delete(ptr)
仅在于delete
调用ptr
析构函数吗?或者换句话说,是否delete ptr
首先调用析构函数ptr
然后operator delete(ptr)
释放分配的内存?然后在delete ptr
技术上等价于以下内容:
T * ptr = new T;
//delete ptr equivalent:
ptr->~T();
::operator delete(static_cast<void *>(ptr));
?