首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::allocator_traits::destroy

Defined in header <memory>

?

?

template< class T > static void destroy( Alloc& a, T* p );

?

(since C++11)

调用指向的对象的析构函数。p.如有可能,请致电a.destroy(p)如果不可能的话%28例如。a没有成员函数destroy()%29,然后调用*p直接,如p->~T()...

参数

a

-

allocator to use for destruction

p

-

pointer to the object being destroyed

返回值

%280%29

注记

因为该函数提供自动回退到直接调用析构函数,所以成员函数destroy()是可选的Allocator要求自C++11。

另见

destroy (deprecated in C++17)

destructs an object in allocated storage (public member function of std::allocator)

代码语言:txt
复制
 ? cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com