[unique.ptr.dltr]

# 20 Memory management library [[mem]](./#mem)

## 20.3 Smart pointers [[smartptr]](smartptr#unique.ptr.dltr)

### 20.3.1 Unique-ownership pointers [[unique.ptr]](unique.ptr#dltr)

#### 20.3.1.2 Default deleters [unique.ptr.dltr]

#### [20.3.1.2.1](#general) General [[unique.ptr.dltr.general]](unique.ptr.dltr.general)

[1](#general-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L2258)

The class template default_delete serves as the default deleter (destruction policy)
for the class template unique_ptr[.](#general-1.sentence-1)

[2](#general-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L2262)

The template parameter T of default_delete may be
an incomplete type[.](#general-2.sentence-1)

#### [20.3.1.2.2](#dflt) default_delete [[unique.ptr.dltr.dflt]](unique.ptr.dltr.dflt)

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; };}

[ð](#lib:default_delete,constructor)

`template<class U> constexpr default_delete(const default_delete<U>& other) noexcept;
`

[1](#dflt-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L2284)

*Constraints*: U* is implicitly convertible to T*[.](#dflt-1.sentence-1)

[2](#dflt-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L2288)

*Effects*: Constructs a default_delete object
from another default_delete<U> object[.](#dflt-2.sentence-1)

[ð](#lib:operator(),default_delete)

`constexpr void operator()(T* ptr) const;
`

[3](#dflt-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L2300)

*Mandates*: T is a complete type[.](#dflt-3.sentence-1)

[4](#dflt-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L2304)

*Effects*: Calls delete on ptr[.](#dflt-4.sentence-1)

#### [20.3.1.2.3](#dflt1) default_delete<T[]> [[unique.ptr.dltr.dflt1]](unique.ptr.dltr.dflt1)

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; };}

[ð](#lib:default_delete,constructor_)

`template<class U> constexpr default_delete(const default_delete<U[]>& other) noexcept;
`

[1](#dflt1-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L2327)

*Constraints*: U(*)[] is convertible to T(*)[][.](#dflt1-1.sentence-1)

[2](#dflt1-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L2331)

*Effects*: Constructs a default_delete object from another default_delete<U[]> object[.](#dflt1-2.sentence-1)

[ð](#lib:operator(),default_delete_)

`template<class U> constexpr void operator()(U* ptr) const;
`

[3](#dflt1-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L2342)

*Constraints*: U(*)[] is convertible to T(*)[][.](#dflt1-3.sentence-1)

[4](#dflt1-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L2346)

*Mandates*: U is a complete type[.](#dflt1-4.sentence-1)

[5](#dflt1-5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L2350)

*Effects*: Calls delete[] on ptr[.](#dflt1-5.sentence-1)
