Namespaces
Variants

std:: unstoppable_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
定义于头文件 <stop_token>
template < class Token >

concept unstoppable_token =
std :: stoppable_token < Token > &&
requires ( const Token tok ) {
requires std:: bool_constant < ( ! tok. stop_possible ( ) ) > :: value ;

} ;
(C++26 起)

概念 unstoppable_token<Token> stoppable_token 提出了额外要求,即该类型不允许停止操作。这意味着表达式 tok. stop_possible ( ) 必须能在常量表达式中使用,且返回 false