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)。
[编辑] 参数
other | - | 另一个 stop_token 对象,用于与之共享停止状态或从中获取停止状态 |