[expected.un.swap]

# 22 General utilities library [[utilities]](./#utilities)

## 22.8 Expected objects [[expected]](expected#un.swap)

### 22.8.3 Class template unexpected [[expected.unexpected]](expected.unexpected#expected.un.swap)

#### 22.8.3.4 Swap [expected.un.swap]

[ð](#lib:swap,unexpected)

`constexpr void swap(unexpected& other) noexcept(is_nothrow_swappable_v<E>);
`

[1](#1)

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

*Mandates*: is_swappable_v<E> is true[.](#1.sentence-1)

[2](#2)

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

*Effects*: Equivalent to:using std​::​swap; swap(*unex*, other.*unex*);

[ð](#itemdecl:2)

`friend constexpr void swap(unexpected& x, unexpected& y) noexcept(noexcept(x.swap(y)));
`

[3](#3)

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

*Constraints*: is_swappable_v<E> is true[.](#3.sentence-1)

[4](#4)

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

*Effects*: Equivalent to x.swap(y)[.](#4.sentence-1)
