namespace std {
struct get_stop_token_t { unspecified };
inline constexpr get_stop_token_t get_stop_token{};
}
概要
get_stop_token
は、クエリ可能オブジェクトから停止トークンを取得するクエリオブジェクトである。
コア定数式forwarding_query(get_stop_token)
はtrue
値を返す。
効果
呼び出し式get_stop_token(env)
は下記と等価であり、stoppable_token
を満たす型の値となる。
- 引数
env
がconst修飾されたcenv
を用いて、式cenv.query(get_stop_token)
が適格であればその値。 - そうでなければ、
never_stop_token{}
例外
投げない
カスタマイゼーションポイント
const修飾クエリ可能オブジェクトcenv
に対して式cenv.query(get_stop_token)
が呼び出される。
このとき、noexcept(cenv.query(get_stop_token)) == true
であること。
例
#include <concepts>
#include <stop_token>
#include <execution>
namespace ex = std::execution;
int main()
{
// just Senderは停止トークンを持たない
ex::sender auto sndr = ex::just(42);
auto token = std::get_stop_token(ex::get_env(sndr));
static_assert(std::same_as<decltype(token), std::never_stop_token>);
}
出力
バージョン
言語
- C++26
処理系
- Clang: ??
- GCC: ??
- ICC: ??
- Visual C++: ??