◐ Shell
clean mode source ↗

std::stoppable_token - cppreference.com

来自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> 指定一种停止令牌的基本接口,它为 copyableequality_comparable,并允许进行轮询以检查是否可能请求停止及是否已做出请求。

语义要求

参阅