std::stop_token::operator=
來自 cppreference.com
< cpp | thread | stop token
std::stop_token& operator=( const std::stop_token& other ) noexcept; |
(1) | (C++20 起) |
std::stop_token& operator=( std::stop_token&& other ) noexcept; |
(2) | (C++20 起) |
用 other 的關聯停止狀態替換當前物件的關聯停止狀態。
1) 將 other 的關聯停止狀態複製賦值給 *this 的關聯停止狀態。等價於 stop_token(other).swap(*this)。
2) 將 other 的關聯停止狀態移動賦值給 *this 的關聯停止狀態。賦值後,*this 包含 other 之前的關聯停止狀態,而 other 不再具有關聯停止狀態。等價於 stop_token(std::move(other)).swap(*this)。
[編輯] 引數
其他 | - | 另一個 stop_token 物件,用於共享或獲取停止狀態。 |