Template Struct receiver

Struct Documentation

template<typename T, typename E = std::exception_ptr>
struct receiver

Concept that defines a bare-bone receiver.

A receiver represents the continuation of an asynchronous operation. An asynchronous operation may complete with a (possibly empty) set of values, an error, or it may be canceled. A receiver has three principal operations corresponding to the three ways an asynchronous operation may complete:

concore::set_value(), concore::set_error(), and concore::set_done(). These are collectively known as a receiver’s completion-signal operations.
Template Parameters
  • T: The type being checked to see if it’s a bare-bone receiver

  • E: The type of errors that the receiver accepts; default std::exception_ptr

The following constraints must hold with respect to receiver’s completion-signal operations:

  • None of a receiver’s completion-signal operations shall be invoked before concore::start() has been called on the operation state object that was returned by concore::connect() to connect that receiver to a sender.

  • Once concore::start() has been called on the operation state object, exactly one of the receiver’s completion-signal operations shall complete non-exceptionally before the receiver is destroyed.

  • If concore::set_value() exits with an exception, it is still valid to call concore::set_error() or concore::set_done() on the receiver.

A bare-bone receiver is a receiver that only checks for the following CPOs:

The set_value() CPO is ignored in a bare-bone receiver, as a receiver may have many ways to be notified about the success of a sender.

In addition to these, the type should be move constructible and copy constructible.

See

receiver_of, set_done(), set_error()