Template Struct as_invocable

Struct Documentation

template<typename R>
struct concore::v1::as_invocable

Wrapper that transforms a receiver into a functor.

The receiver should model

receiver_of<>.
Template Parameters
  • R: The type of the receiver

This will store a reference to the receiver; the receiver must not get out of scope.

When this functor is called set_value() will be called on the receiver. If an exception is thrown, the set_error() function is called.

If the functor is never called, the destructor of this object will call set_done().

See

as_receiver

Public Functions

as_invocable(R &r) noexcept

Constructor from receiver.

as_invocable(as_invocable &&other) noexcept

Move constructor.

as_invocable &operator=(as_invocable &&other) noexcept

Move assignment.

as_invocable(const as_invocable&) = delete

Copy constructor is DISABLED.

as_invocable &operator=(const as_invocable&) = delete

Copy assignment is DISABLED.

~as_invocable()

Destructor.

void operator()() noexcept

Call operator.

This forwards the call to the receiver by calling set_value(). If an exception is thrown during this operation, then set_error() is called passing the exception.

See

set_value(), set_error()