Difference between revisions of "cpp/thread/packaged task/swap2"
From cppreference.com
< cpp | thread | packaged task
m (Update links.) |
Andreas Krug (Talk | contribs) m (fmt, {{c}}) |
||
(5 intermediate revisions by 4 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/navbar}} | {{cpp/thread/packaged_task/navbar}} | ||
{{dcl begin}} | {{dcl begin}} | ||
− | {{dcl | | + | {{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}} | {{dcl end}} | ||
− | Specializes the {{lc|std::swap}} algorithm for {{lc|std::packaged_task}}. Exchanges the state of {{ | + | 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 begin}} | ||
− | {{par | lhs, rhs | packaged tasks whose states to swap}} | + | {{par|lhs, rhs|packaged tasks whose states to swap}} |
{{par end}} | {{par end}} | ||
===Return value=== | ===Return value=== | ||
(none) | (none) | ||
− | |||
− | |||
− | |||
===Example=== | ===Example=== | ||
{{example | {{example | ||
− | + | |code= | |
− | + | |output= | |
}} | }} | ||
===See also=== | ===See also=== | ||
{{dsc begin}} | {{dsc begin}} | ||
− | {{dsc inc | cpp/thread/packaged_task/dsc swap}} | + | {{dsc inc|cpp/thread/packaged_task/dsc swap}} |
{{dsc end}} | {{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) |