...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
A customisation point that submits a sender to a receiver.
constexpr unspecified submit = unspecified;
The name execution::submit
denotes a customisation point object.
For some subexpressions s
and r
, let S
be a type such that decltype((s))
is S
and let
R
be a type such that decltype((r))
is R
.
The expression execution::submit(s, r)
is ill-formed if sender_to<S,
R>
is not true
. Otherwise, it is expression-equivalent
to:
s.submit(r)
, if that expression is valid and S
models sender
. If the function selected does not submit
the receiver object r
via the sender s
, the
program is ill-formed with no diagnostic required.
submit(s, r)
, if that expression is valid and
S
models sender
, with overload resolution performed
in a context that includes the declaration void submit();
and that does not include a declaration of execution::submit
.
If the function selected by overload resolution does not submit the receiver
object r
via the sender s
, the program is ill-formed
with no diagnostic required.
execution::start((new submit_receiver<S, R>{s,r})->state_)
,
where submit_receiver
is an implementation-defined class
template equivalent to:
template<class S, class R> struct submit_receiver { struct wrap { submit_receiver * p_; template<class...As> requires receiver_of<R, As...> void set_value(As&&... as) && noexcept(is_nothrow_receiver_of_v<R, As...>) { execution::set_value(std::move(p_->r_), (As&&) as...); delete p_; } template<class E> requires receiver<R, E> void set_error(E&& e) && noexcept { execution::set_error(std::move(p_->r_), (E&&) e); delete p_; } void set_done() && noexcept { execution::set_done(std::move(p_->r_)); delete p_; } }; remove_cvref_t<R> r_; connect_result_t<S, wrap> state_; submit_receiver(S&& s, R&& r) : r_((R&&) r) , state_(execution::connect((S&&) s, wrap{this})) {} };
Header: boost/asio/execution/submit.hpp
Convenience header: boost/asio/execution.hpp