GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::experimental::optional::swap(3) C++ Standard Libary std::experimental::optional::swap(3)

std::experimental::optional::swap - std::experimental::optional::swap


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.


other - the optional object to exchange the contents with


(none)


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.


std::swap(std::experimental::optional) specializes the std::swap algorithm
(function)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.