Search:
Reference
<future>
promise
swap
function template
<future>
std::
swap (promise)
template <class T> void swap (promise<T>& x, promise<T>& y) noexcept;
Swap promises
Exchanges the
shared states
(or lack of) between
x
and
y
.
This is an overload of
swap
that behaves as if
x.
swap
(y)
was called.
Parameters
x,y
promise
objects of the same type (with the same template parameter).
Return value
none
Data races
Both objects,
x
and
y
, are modified.
Exception safety
No-throw guarantee:
never throws exceptions.
See also
promise::swap
Swap shared states
(public member function )
promise::operator=
Move-assign promise
(public member function )
swap
Exchange values of two objects
(function template )
C++
Information
Tutorials
Reference
Articles
Forum
Reference
C library:
<cassert> (assert.h)
<cctype> (ctype.h)
<cerrno> (errno.h)
<cfenv> (fenv.h)
<cfloat> (float.h)
<cinttypes> (inttypes.h)
<ciso646> (iso646.h)
<climits> (limits.h)
<clocale> (locale.h)
<cmath> (math.h)
<csetjmp> (setjmp.h)
<csignal> (signal.h)
<cstdarg> (stdarg.h)
<cstdbool> (stdbool.h)
<cstddef> (stddef.h)
<cstdint> (stdint.h)
<cstdio> (stdio.h)
<cstdlib> (stdlib.h)
<cstring> (string.h)
<ctgmath> (tgmath.h)
<ctime> (time.h)
<cuchar> (uchar.h)
<cwchar> (wchar.h)
<cwctype> (wctype.h)
Containers:
<array>
<deque>
<forward_list>
<list>
<map>
<queue>
<set>
<stack>
<unordered_map>
<unordered_set>
<vector>
Input/Output:
<fstream>
<iomanip>
<ios>
<iosfwd>
<iostream>
<istream>
<ostream>
<sstream>
<streambuf>
Multi-threading:
<atomic>
<condition_variable>
<future>
<mutex>
<thread>
Other:
<algorithm>
<bitset>
<chrono>
<codecvt>
<complex>
<exception>
<functional>
<initializer_list>
<iterator>
<limits>
<locale>
<memory>
<new>
<numeric>
<random>
<ratio>
<regex>
<stdexcept>
<string>
<system_error>
<tuple>
<typeindex>
<typeinfo>
<type_traits>
<utility>
<valarray>
<future>
classes:
future
future_error
packaged_task
promise
shared_future
enum classes:
future_errc
future_status
launch
functions:
async
future_category
promise
promise::promise
promise::~promise
member functions:
promise::get_future
promise::operator=
promise::set_exception
promise::set_exception_at_thread_exit
promise::set_value
promise::set_value_at_thread_exit
promise::swap
non-member overloads:
swap (promise)
non-member specializations:
uses_allocator<promise>