[pairs.spec] # 22 General utilities library [[utilities]](./#utilities) ## 22.3 Pairs [[pairs]](pairs#spec) ### 22.3.3 Specialized algorithms [pairs.spec] [🔗](#lib:operator==,pair) `template constexpr bool operator==(const pair& x, const pair& y); ` [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L1305) *Constraints*: x.first == y.first and x.second == y.second are valid expressions and each of decltype(x.first == y.first) anddecltype(x.second == y.second) models *boolean- testable*[.](#1.sentence-1) [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L1312) *Returns*: x.first == y.first && x.second == y.second[.](#2.sentence-1) [🔗](#lib:operator%3c=%3e,pair) `template constexpr common_comparison_category_t, synth-three-way-result> operator<=>(const pair& x, const pair& y); ` [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L1326) *Effects*: Equivalent to:if (auto c = *synth-three-way*(x.first, y.first); c != 0) return c;return *synth-three-way*(x.second, y.second); [🔗](#lib:swap,pair) `template constexpr void swap(pair& x, pair& y) noexcept(noexcept(x.swap(y))); template constexpr void swap(const pair& x, const pair& y) noexcept(noexcept(x.swap(y))); ` [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L1344) *Constraints*: - [(4.1)](#4.1) For the first overload,is_swappable_v is true andis_swappable_v is true[.](#4.1.sentence-1) - [(4.2)](#4.2) For the second overload,is_swappable_v is true andis_swappable_v is true[.](#4.2.sentence-1) [5](#5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L1357) *Effects*: Equivalent to x.swap(y)[.](#5.sentence-1) [🔗](#lib:make_pair) `template constexpr pair, unwrap_ref_decay_t> make_pair(T1&& x, T2&& y); ` [6](#6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L1369) *Returns*: pair, unwrap_ref_decay_t>(std::forward(x), std::forward(y)) [7](#7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L1377) [*Example [1](#example-1)*: In place of:return pair(5, 3.1415926); // explicit types a C++ program may contain:return make_pair(5, 3.1415926); // types are deduced — *end example*]