Namespaces
Variants

swap (std::stop_token)

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
friend void swap ( stop_token & lhs, stop_token & rhs ) noexcept ;
(C++20 起)

std::swap 算法重载 std::stop_token 的交换操作。将 lhs 的关联停止状态与 rhs 的停止状态进行交换。实际效果等同于调用 lhs. swap ( rhs )

此函数对普通的 非限定查找 限定查找 不可见,仅当 std::stop_token 作为参数的关联类时,才能通过 实参依赖查找 找到该函数。

参数

lhs, rhs - 要交换的 stop_token

返回值

(无)