asio C++ library

PrevUpHomeNext

execution::submit

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:

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})) {}
  };
Requirements

Header: asio/execution/submit.hpp

Convenience header: asio/execution.hpp


PrevUpHomeNext