std::stop_token::stop_token

< cpp‎ | thread‎ | stop token
stop_token() noexcept;
(1) (C++20 起)
stop_token( const stop_token& other ) noexcept;
(2) (C++20 起)
stop_token( stop_token&& other ) noexcept;
(3) (C++20 起)

构造新的 stop_token 对象。

1) 构造无关联停止状态的空 stop_token
2) 复制构造函数。构造关联停止状态与 other 相同的 stop_token
3) 移动构造函数。构造关联停止状态与 other 相同的 stop_token ;将 other 置于空状态。

参数

other - 用于构造此 stop_token 对象的另一 stop_token 对象

后条件

1) stop_possible()stop_requested() 均为 false
2) *thisother 共享同一停止状态且比较相等
3) *this 拥有 other 先前的停止状态,而 other.stop_possible()false