Files
cppdraft_translate/cppdraft/exec/queries.md
2025-10-25 03:02:53 +03:00

15 KiB
Raw Blame History

[exec.queries]

33 Execution control library [exec]

33.5 Queries [exec.queries]

33.5.1 forwarding_query [exec.fwd.env]

1

#

forwarding_query asks a query object whether it should be forwarded through queryable adaptors.

2

#

The name forwarding_query denotes a query object.

For some query object q of type Q,forwarding_query(q) is expression-equivalent to:

  • (2.1)

    MANDATE-NOTHROW(q.query(forwarding_query)) if that expression is well-formed. Mandates: The expression above has type bool and is a core constant expression if q is a core constant expression.

  • (2.2)

    Otherwise, true if derived_from<Q, forwarding_query_t> is true.

  • (2.3)

    Otherwise, false.

33.5.2 get_allocator [exec.get.allocator]

1

#

get_allocator asks a queryable object for its associated allocator.

2

#

The name get_allocator denotes a query object.

For a subexpression env,get_allocator(env) is expression-equivalent toMANDATE-NOTHROW(AS-CONST(env).query(get_allocator)).

Mandates: If the expression above is well-formed, its type satisfiessimple-allocator ([allocator.requirements.general]).

3

#

forwarding_query(get_allocator) is a core constant expression and has value true.

33.5.3 get_stop_token [exec.get.stop.token]

1

#

get_stop_token asks a queryable object for an associated stop token.

2

#

The name get_stop_token denotes a query object.

For a subexpression env,get_stop_token(env) is expression-equivalent to:

  • (2.1)

    MANDATE-NOTHROW(AS-CONST(env).query(get_stop_token)) if that expression is well-formed. Mandates: The type of the expression above satisfies stoppable_token.

  • (2.2)

    Otherwise, never_stop_token{}.

3

#

forwarding_query(get_stop_token) is a core constant expression and has value true.

33.5.4 execution::get_env [exec.get.env]

1

#

execution::get_env is a customization point object.

For a subexpression o,execution::get_env(o) is expression-equivalent to:

2

#

The value of get_env(o) shall be valid while o is valid.

3

#

[Note 1:

When passed a sender object,get_env returns the sender's associated attributes.

When passed a receiver,get_env returns the receiver's associated execution environment.

— end note]

33.5.5 execution::get_domain [exec.get.domain]

1

#

get_domain asks a queryable object for its associated execution domain tag.

2

#

The name get_domain denotes a query object.

For a subexpression env,get_domain(env) is expression-equivalent toMANDATE-NOTHROW(AS-CONST(env).query(get_domain)).

3

#

forwarding_query(execution::get_domain) is a core constant expression and has value true.

33.5.6 execution::get_scheduler [exec.get.scheduler]

1

#

get_scheduler asks a queryable object for its associated scheduler.

2

#

The name get_scheduler denotes a query object.

For a subexpression env,get_scheduler(env) is expression-equivalent toMANDATE-NOTHROW(AS-CONST(env).query(get_scheduler)).

Mandates: If the expression above is well-formed, its type satisfies scheduler.

3

#

forwarding_query(execution::get_scheduler) is a core constant expression and has value true.

33.5.7 execution::get_delegation_scheduler [exec.get.delegation.scheduler]

1

#

get_delegation_scheduler asks a queryable object for a scheduler that can be used to delegate work to for the purpose of forward progress delegation ([intro.progress]).

2

#

The name get_delegation_scheduler denotes a query object.

For a subexpression env,get_delegation_scheduler(env) is expression-equivalent toMANDATE-NOTHROW(AS-CONST(env).query(get_delegation_scheduler)).

Mandates: If the expression above is well-formed, its type satisfies scheduler.

3

#

forwarding_query(execution::get_delegation_scheduler) is a core constant expression and has value true.

33.5.8 execution::get_forward_progress_guarantee [exec.get.fwd.progress]

namespace std::execution {enum class forward_progress_guarantee { concurrent, parallel, weakly_parallel };}

1

#

get_forward_progress_guarantee asks a scheduler about the forward progress guarantee of execution agents created by that scheduler's associated execution resource ([intro.progress]).

2

#

The name get_forward_progress_guarantee denotes a query object.

For a subexpression sch, let Sch be decltype((sch)).

If Sch does not satisfy scheduler,get_forward_progress_guarantee is ill-formed.

Otherwise,get_forward_progress_guarantee(sch) is expression-equivalent to:

  • (2.1)

    MANDATE-NOTHROW(AS-CONST(sch).query(get_forward_progress_guarantee)), if that expression is well-formed. Mandates: The type of the expression above is forward_progress_guarantee.

  • (2.2)

    Otherwise, forward_progress_guarantee::weakly_parallel.

3

#

If get_forward_progress_guarantee(sch) for some scheduler sch returns forward_progress_guarantee::concurrent, all execution agents created by that scheduler's associated execution resource shall provide the concurrent forward progress guarantee.

If it returns forward_progress_guarantee::parallel, all such execution agents shall provide at least the parallel forward progress guarantee.

33.5.9 execution::get_completion_scheduler [exec.get.compl.sched]

1

#

get_completion_scheduler<completion-tag> obtains the completion scheduler associated with a completion tag from a sender's attributes.

2

#

The name get_completion_scheduler denotes a query object template.

For a subexpression q, the expression get_completion_scheduler<completion-tag>(q) is ill-formed if completion-tag is not one ofset_value_t, set_error_t, or set_stopped_t.

Otherwise, get_completion_scheduler<completion-tag>(q) is expression-equivalent toMANDATE-NOTHROW(AS-CONST(q).query(get_completion_scheduler<completion-tag>))Mandates: If the expression above is well-formed, its type satisfies scheduler.

3

#

Let completion-fn be a completion function ([exec.async.ops]); let completion-tag be the associated completion tag of completion-fn; let args be a pack of subexpressions; and let sndr be a subexpression such that sender<decltype((sndr))> is true andget_completion_scheduler<completion-tag>(get_env(sndr)) is well-formed and denotes a scheduler sch.

If an asynchronous operation created by connecting sndr with a receiver rcvr causes the evaluation of completion-fn(rcvr, args...), the behavior is undefined unless the evaluation happens on an execution agent that belongs to sch's associated execution resource.

4

#

The expressionforwarding_query(get_completion_scheduler<completion-tag>) is a core constant expression and has value true.

33.5.10 execution::get_await_completion_adaptor [exec.get.await.adapt]

1

#

get_await_completion_adaptor asks a queryable object for its associated awaitable completion adaptor.

2

#

The name get_await_completion_adaptor denotes a query object.

For a subexpression env,get_await_completion_adaptor(env) is expression-equivalent toMANDATE-NOTHROW(AS-CONST(env).query(get_await_completion_adaptor))

3

#

forwarding_query(execution::get_await_completion_adaptor) is a core constant expression and has value true.