[util.smartptr.shared.mod]

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

## 20.3 Smart pointers [[smartptr]](smartptr#util.smartptr.shared.mod)

### 20.3.2 Shared-ownership pointers [[util.sharedptr]](util.sharedptr#util.smartptr.shared.mod)

#### 20.3.2.2 Class template shared_ptr [[util.smartptr.shared]](util.smartptr.shared#mod)

#### 20.3.2.2.5 Modifiers [util.smartptr.shared.mod]

[ð](#lib:swap,shared_ptr)

`constexpr void swap(shared_ptr& r) noexcept;
`

[1](#1)

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

*Effects*: Exchanges the contents of *this and r[.](#1.sentence-1)

[ð](#lib:reset,shared_ptr)

`constexpr void reset() noexcept;
`

[2](#2)

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

*Effects*: Equivalent to shared_ptr().swap(*this)[.](#2.sentence-1)

[ð](#lib:reset,shared_ptr_)

`template<class Y> constexpr void reset(Y* p);
`

[3](#3)

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

*Effects*: Equivalent to shared_ptr(p).swap(*this)[.](#3.sentence-1)

[ð](#lib:reset,shared_ptr__)

`template<class Y, class D> constexpr void reset(Y* p, D d);
`

[4](#4)

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

*Effects*: Equivalent to shared_ptr(p, d).swap(*this)[.](#4.sentence-1)

[ð](#lib:reset,shared_ptr___)

`template<class Y, class D, class A> constexpr void reset(Y* p, D d, A a);
`

[5](#5)

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

*Effects*: Equivalent to shared_ptr(p, d, a).swap(*this)[.](#5.sentence-1)
