![]() |
Home | Libraries | People | FAQ | More |
A customisation point that connects a sender to a receiver.
constexpr unspecified connect = unspecified;
The name execution::connect 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::connect(s, r) is expression-equivalent to:
s.connect(r),
if that expression is valid, if its type satisfies operation_state,
and if S satisfies sender.
connect(s, r),
if that expression is valid, if its type satisfies operation_state,
and if S satisfies sender, with overload resolution performed
in a context that includes the declaration void
connect();
and that does not include a declaration of execution::connect.
Otherwise, as_operation{s, r}, if r
is not an instance of as_receiver<F, S> for some type F,
and if receiver_of<R> && executor_of<remove_cvref_t<S>, as_invocable<remove_cvref_t<R>, S>> is true,
where as_operation is
an implementation-defined class equivalent to
template <class S, class R> struct as_operation { remove_cvref_t<S> e_; remove_cvref_t<R> r_; void start() noexcept try { execution::execute(std::move(e_), as_invocable<remove_cvref_t<R>, S>{r_}); } catch(...) { execution::set_error(std::move(r_), current_exception()); } };
and as_invocable is a class
template equivalent to the following:
template<class R> struct as_invocable { R* r_; explicit as_invocable(R& r) noexcept : r_(std::addressof(r)) {} as_invocable(as_invocable && other) noexcept : r_(std::exchange(other.r_, nullptr)) {} ~as_invocable() { if(r_) execution::set_done(std::move(*r_)); } void operator()() & noexcept try { execution::set_value(std::move(*r_)); r_ = nullptr; } catch(...) { execution::set_error(std::move(*r_), current_exception()); r_ = nullptr; } };
execution::connect(s, r) is ill-formed.
Header: boost/asio/execution/connect.hpp
Convenience header: boost/asio/execution.hpp