- execution[meta header]
- cpo[meta id-type]
- std[meta namespace]
- cpp26[meta cpp]
namespace std {
struct get_stop_token_t { unspecified };
inline constexpr get_stop_token_t get_stop_token{};
}- unspecified[italic]
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>);
}- std::get_stop_token[color ff0000]
- ex::sender[link execution/sender.md]
- ex::just[link execution/just.md]
- ex::get_env[link execution/get_env.md]
- std::never_stop_token[link /reference/stop_token/never_stop_token.md]
- C++26
- Clang: ??
- GCC: ??
- ICC: ??
- Visual C++: ??