[optional.specalg] # 22 General utilities library [[utilities]](./#utilities) ## 22.5 Optional objects [[optional]](optional#specalg) ### 22.5.10 Specialized algorithms [optional.specalg] [🔗](#lib:swap,optional) `template constexpr void swap(optional& x, optional& y) noexcept(noexcept(x.swap(y))); ` [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L5456) *Constraints*: is_reference_v || (is_move_constructible_v && is_swappable_v) is true[.](#1.sentence-1) [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L5463) *Effects*: Calls x.swap(y)[.](#2.sentence-1) [🔗](#lib:make_optional) `template constexpr optional> make_optional(T&& v); ` [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L5474) *Constraints*: The call to make_optional does not use an explicit [*template-argument-list*](temp.names#nt:template-argument-list "13.3 Names of template specializations [temp.names]") that begins with a type [*template-argument*](temp.names#nt:template-argument "13.3 Names of template specializations [temp.names]")[.](#3.sentence-1) [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L5480) *Returns*: optional>(std​::​forward(v))[.](#4.sentence-1) [🔗](#lib:make_optional_) `template constexpr optional make_optional(Args&&... args); ` [5](#5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L5492) *Effects*: Equivalent to: return optional(in_place, std​::​forward(args)...); [🔗](#lib:make_optional__) `template constexpr optional make_optional(initializer_list il, Args&&... args); ` [6](#6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L5504) *Effects*: Equivalent to: return optional(in_place, il, std​::​forward(args)...);