class template
<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 type T* and deletes it.

The non-specialized version simply uses delete for the deletion operation.

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

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).

Template parameters

T
The type of object to be deleted.

Member functions