std::experimental::optional<T>::swap (3) - Linux Manuals
std::experimental::optional<T>::swap: std::experimental::optional<T>::swap
Command to display std::experimental::optional<T>::swap
manual in Linux: $ man 3 std::experimental::optional<T>::swap
NAME
std::experimental::optional<T>::swap - std::experimental::optional<T>::swap
Synopsis
void swap( optional& other ) noexcept(/* see below */); (library fundamentals TS)
Swaps the contents with those of other.
* If neither *this nor other contain a value, the function has no effect.
* If only one of *this and other contains a value (let's call this object in and the other un), the contained value of un is direct-initialized from std::move(*in), followed by destruction of the contained value of in as if by in.val->T::~T(). After this call, in does not contain a value un contains a value.
* If both *this and other contain values, the contained values are exchanged by calling using std::swap; swap(**this, *other). T lvalues must satisfy Swappable.
Parameters
other - the optional object to exchange the contents with
Return value
(none)
Exceptions
noexcept specification:
noexcept(std::is_nothrow_move_constructible<T>::value &&
noexcept(swap(std::declval<T&>(), std::declval<T&>())))
In the case of thrown exception, the states of the contained values of *this and other are determined by the exception safety guarantees of swap of type T or T's move constructor, whichever is called. For both *this and other, if the object contained a value, it is left containing a value, and the other way round.
See also
specializes the std::swap algorithm
std::swap(std::experimental::optional) (function)
Pages related to std::experimental::optional<T>::swap
- std::experimental::optional<T>::emplace (3) - std::experimental::optional<T>::emplace
- std::experimental::optional<T>::operator->,std::experimental::optional<T>::operator* (3) - std::experimental::optional<T>::operator->,std::experimental::optional<T>::operator*
- std::experimental::optional<T>::operator= (3) - std::experimental::optional<T>::operator=
- std::experimental::optional<T>::operatorbool (3) - std::experimental::optional<T>::operatorbool
- std::experimental::optional<T>::optional (3) - std::experimental::optional<T>::optional
- std::experimental::optional<T>::value (3) - std::experimental::optional<T>::value
- std::experimental::optional<T>::value_or (3) - std::experimental::optional<T>::value_or
- std::experimental::optional<T>::~optional (3) - std::experimental::optional<T>::~optional
- std::experimental::optional (3) - std::experimental::optional
- std::experimental::observer_ptr (3) - std::experimental::observer_ptr
- std::experimental::observer_ptr<W>::get (3) - std::experimental::observer_ptr<W>::get
- std::experimental::observer_ptr<W>::observer_ptr (3) - std::experimental::observer_ptr<W>::observer_ptr
- std::experimental::observer_ptr<W>::operator*, (3) - std::experimental::observer_ptr<W>::operator*,
- std::experimental::observer_ptr<W>::operator*,std::experimental::observer_ptr<W>::operator-> (3) - std::experimental::observer_ptr<W>::operator*,std::experimental::observer_ptr<W>::operator->
- std::experimental::observer_ptr<W>::operatorbool (3) - std::experimental::observer_ptr<W>::operatorbool
- std::experimental::observer_ptr<W>::operatorelement_type* (3) - std::experimental::observer_ptr<W>::operatorelement_type*
- std::experimental::observer_ptr<W>::release (3) - std::experimental::observer_ptr<W>::release
- std::experimental::observer_ptr<W>::reset (3) - std::experimental::observer_ptr<W>::reset
- std::experimental::observer_ptr<W>::swap (3) - std::experimental::observer_ptr<W>::swap
- std::experimental::ostream_joiner (3) - std::experimental::ostream_joiner
- std::experimental::ostream_joiner<DelimT,CharT,Traits>::operator++ (3) - std::experimental::ostream_joiner<DelimT,CharT,Traits>::operator++
- std::experimental::ostream_joiner<DelimT,CharT,Traits>::operator= (3) - std::experimental::ostream_joiner<DelimT,CharT,Traits>::operator=
- std::experimental::ostream_joiner<DelimT,CharT,Traits>::ostream_joiner (3) - std::experimental::ostream_joiner<DelimT,CharT,Traits>::ostream_joiner
- std::experimental::overaligned_tag,std::experimental::overaligned (3) - std::experimental::overaligned_tag,std::experimental::overaligned