Namespaces
Variants

std::stop_token:: operator=

From cppreference.net
Concurrency support library
Threads
(C++11)
(C++20)
this_thread namespace
(C++11)
(C++11)
Cooperative cancellation
Mutual exclusion
Generic lock management
Condition variables
(C++11)
Semaphores
Latches and Barriers
(C++20)
(C++20)
Futures
(C++11)
(C++11)
(C++11)
Safe reclamation
Hazard pointers
Atomic types
(C++11)
(C++20)
Initialization of atomic types
(C++11) (deprecated in C++20)
(C++11) (deprecated in C++20)
Memory ordering
(C++11) (deprecated in C++26)
Free functions for atomic operations
Free functions for atomic flags
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 对象