Difference between revisions of "cpp/thread/packaged task/swap2"
From cppreference.com
< cpp | thread | packaged task
Andreas Krug (Talk | contribs) m (fmt, {{c}}) |
|||
(11 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
− | {{cpp/title | swap<small>(std::packaged_task)</small>}} | + | {{cpp/title|swap<small>(std::packaged_task)</small>}} |
− | {{cpp/thread/packaged_task/ | + | {{cpp/thread/packaged_task/navbar}} |
− | {{ | + | {{dcl begin}} |
− | {{ | + | {{dcl|since=c++11| |
− | template< class Function, class | + | template< class Function, class... Args > |
void swap( packaged_task<Function(Args...)> &lhs, | void swap( packaged_task<Function(Args...)> &lhs, | ||
− | packaged_task<Function(Args...)> &rhs ); | + | packaged_task<Function(Args...)> &rhs ) noexcept; |
}} | }} | ||
− | {{ | + | {{dcl end}} |
− | Specializes the {{ | + | Specializes the {{lc|std::swap}} algorithm for {{lc|std::packaged_task}}. Exchanges the state of {{c|lhs}} with that of {{c|rhs}}. Effectively calls {{c|lhs.swap(rhs)}}. |
===Parameters=== | ===Parameters=== | ||
− | {{ | + | {{par begin}} |
− | {{ | + | {{par|lhs, rhs|packaged tasks whose states to swap}} |
− | {{ | + | {{par end}} |
===Return value=== | ===Return value=== | ||
(none) | (none) | ||
− | |||
− | |||
− | |||
===Example=== | ===Example=== | ||
− | {{example | + | {{example |
− | + | |code= | |
− | + | |output= | |
}} | }} | ||
===See also=== | ===See also=== | ||
− | {{ | + | {{dsc begin}} |
− | {{ | + | {{dsc inc|cpp/thread/packaged_task/dsc swap}} |
− | {{ | + | {{dsc end}} |
+ | |||
+ | {{langlinks|de|es|fr|it|ja|pt|ru|zh}} |
Latest revision as of 01:44, 17 August 2023
template< class Function, class... Args > void swap( packaged_task<Function(Args...)> &lhs, |
(since C++11) | |
Specializes the std::swap algorithm for std::packaged_task. Exchanges the state of lhs with that of rhs. Effectively calls lhs.swap(rhs).
Contents |
[edit] Parameters
lhs, rhs | - | packaged tasks whose states to swap |
[edit] Return value
(none)
[edit] Example
This section is incomplete Reason: no example |
[edit] See also
swaps two task objects (public member function) |