std::stoppable_token
来自cppreference.com
并发支持库
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 在标头 <stop_token> 定义
|
||
template< class Token >
concept stoppable_token =
requires (const Token tok) {
typename /*check-type-alias-exists*/<Token::template callback_type>;
{ tok.stop_requested() } noexcept -> std::same_as<bool>;
{ tok.stop_possible() } noexcept -> std::same_as<bool>;
{ Token(tok) } noexcept; // 参见“隐式表达式变体”
} &&
std::copyable<Token> &&
std::equality_comparable<Token>;
|
(C++26 起) | |
| Helper templates |
||
template< template<class> class >
struct /*check-type-alias-exists*/; // 不予定义
|
(仅用于阐述*) | |
概念 stoppable_token<Token> 指定一种停止令牌的基本接口,它为 copyable 且 equality_comparable,并允许进行轮询以检查是否可能请求停止及是否已做出请求。
语义要求
| 本节未完成 |
参阅
(C++26) |
指定一种不允许停止的停止令牌 (概念) [编辑] |
