33 Execution control library [exec]

33.5 Queries [exec.queries]

33.5.12 execution​::​get_completion_domain [exec.get.compl.domain]

get_completion_domain<completion-tag> obtains the completion domain associated with a completion tag from a sender's attributes.
The name get_completion_domain denotes a query object template.
For a subexpression attrs and pack envs, the expression get_completion_domain<completion-tag>(attrs, envs...) is ill-formed if completion-tag is not one of void, set_value_t, set_error_t, or set_stopped_t.
Otherwise, it is expression-equivalent to MANDATE-NOTHROW(D()), where D is:
  • The type of TRY-QUERY(attrs, get_completion_domain<completion-tag>, envs...) if that expression is well-formed.
  • Otherwise, the type of get_completion_domain<set_value_t>(attrs, envs...) if completion-tag is void.
  • Otherwise, the type of TRY-QUERY(get_completion_scheduler<completion-tag>(attrs, envs...), get_completion_domain<set_value_t>, envs...) if that expression is well-formed.
  • Otherwise, default_domain if scheduler<decltype((attrs))> is true and envs is not an empty pack.
  • Otherwise, get_completion_domain<completion-tag>(attrs, envs...) is ill-formed.
For a type Tag, subexpression sndr, and pack envs, let CS be completion_signatures_of_t<decay_t<decltype((sndr))>, decltype((envs))...>.
If both get_completion_domain<Tag>(get_env(sndr), envs...) and CS are well-formed and CS().count-of(Tag()) == 0 is true, the program is ill-formed.
Let completion-fn be a completion function ([exec.async.ops]); let completion-tag be the associated completion tag of completion-fn; let args and envs be packs of subexpressions; and let sndr be a subexpression such that sender<decltype((sndr))> is true and get_completion_domain<completion-tag>(get_env(sndr), envs...) is well-formed and denotes a domain tag D.
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 of an execution resource whose associated execution domain tag is D.
The expression forwarding_query(get_completion_domain<completion-tag>) is a core constant expression and has value true.