std::packaged_task<R(Args...)>::operator=
來自 cppreference.com
< cpp | thread | packaged_task
packaged_task& operator=( const packaged_task& ) = delete; |
(1) | (C++11 起) |
packaged_task& operator=( packaged_task&& rhs ) noexcept; |
(2) | (C++11 起) |
1) 複製賦值運算子被刪除,`std::packaged_task` 是僅可移動的。
2) 釋放共享狀態(如果有),銷燬先前持有的任務,並將 `rhs` 擁有的共享狀態和任務移動到 `*this` 中。`rhs` 此時沒有共享狀態,並且任務已被移出。
[編輯] 引數
rhs | - | 要從中移動的 `std::packaged_task` |
[編輯] 示例
本節不完整 原因:無示例 |
[編輯] 缺陷報告
下列更改行為的缺陷報告追溯地應用於以前出版的 C++ 標準。
缺陷報告 | 應用於 | 釋出時的行為 | 正確的行為 |
---|---|---|---|
LWG 2067 | C++11 | 複製賦值運算子的引數型別為 `packaged_task&` | 添加了 const |