std::stop_token::operator=
来自 cppreference.cn
< 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 对象,用于共享或获取停止状态。 |