类模板
<memory>

std::default_delete

non-specialized
template <class T> class default_delete;
array specialization
template <class T> class default_delete<T[]>;
Default deleter
Function object class, whose function-like invokation takes an object of typeT*and deletes it.

The non-specialized version simply usesdeletefor the deletion operation.

Likewise, the specialization for arrays with runtime length usesdelete[].

This class is specifically designed to be used as the type for the stored deleter object in unique_ptr instantiations or to declare objects passed to unique_ptr and shared_ptr's constructors.

Since this is a lightweight stateless class, using it as deleter on unique_ptr objects shall add no overhead nor size compared to C++ built-in pointers (on most library implementations).

模板参数

T
The type of object to be deleted.

成员函数