std::stop_token::operator=
来自cppreference.com
< cpp | thread | stop token
并发支持库
|
|
std::stop_token
成员函数 | ||||
stop_token::operator=
|
||||
修改器 | ||||
观察器 | ||||
非成员函数 | ||||
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) 。异常
(无)