20 Memory management library [mem]
The class template
default_delete serves as the default deleter (destruction policy)
for the class template
unique_ptr.The template parameter
T of
default_delete may be
an incomplete type
.namespace std {
template<class T> struct default_delete {
constexpr default_delete() noexcept = default;
template<class U> constexpr default_delete(const default_delete<U>&) noexcept;
constexpr void operator()(T*) const;
};
}
template<class U> constexpr default_delete(const default_delete<U>& other) noexcept;
Constraints:
U* is implicitly convertible to
T*. Effects: Constructs a
default_delete object
from another
default_delete<U> object
. constexpr void operator()(T* ptr) const;
Mandates:
T is a complete type
. Effects: Calls
delete on
ptr. namespace std {
template<class T> struct default_delete<T[]> {
constexpr default_delete() noexcept = default;
template<class U> constexpr default_delete(const default_delete<U[]>&) noexcept;
template<class U> constexpr void operator()(U* ptr) const;
};
}
template<class U> constexpr default_delete(const default_delete<U[]>& other) noexcept;
Constraints:
U(*)[] is convertible to
T(*)[]. Effects: Constructs a
default_delete object from another
default_delete<U[]> object
. template<class U> constexpr void operator()(U* ptr) const;
Constraints:
U(*)[] is convertible to
T(*)[]. Mandates:
U is a complete type
. Effects: Calls
delete[] on
ptr.