std::jthread::operator=
来自 cppreference.cn
std::jthread& operator=( std::jthread&& other ) noexcept; |
(since C++20) | |
如果 *this 仍然有一个关联的运行线程(即 joinable() == true),则调用 request_stop(),然后调用 join()。 将 other 的状态赋值给 *this,并将 other 设置为默认构造状态。
在此调用之后,this->get_id() 等于调用前 other.get_id() 的值,并且关联的停止状态也被移动,而 other 不再表示执行线程,也不再具有任何停止状态。
[编辑] 参数
other | - | 要赋值给此 jthread 对象的另一个 jthread 对象 |
[编辑] 返回值
*this