std::allocator<T>::destroy_C++中文网

位置:首页 > C++ 参考手册 >动态内存管理 >std::allocator > std::allocator<T>::destroy

std::allocator<T>::destroy

定义于头文件 <memory>

void destroy( pointer p );

(C++11 前)

template< class U >
void destroy( U* p );

(C++11 起)
(C++17 中弃用)
(C++20 中移除)

调用 p 所指的对象的析构函数

1) 调用 ((T*)p)->~T()

2) 调用 p->~U()

参数

p - 指向要被销毁的对象的指针

返回值

(无)

参阅

[静态]

析构存储于已分配存储的对象
(函数模板)