std::execution::ensure_started

From cppreference.com
< cpp‎ | execution
Defined in header <execution>
execution:: sender auto ensure_started( execution:: sender auto sender ) ;
(since C++26)

Parameters

sender - input sender of which the stopped channel is mapped into err

Return value

Returns a sender which completes when the provided sender completes and sends values equivalent to those of the provided sender

Notes

  • Once ensure_started returns, it is known that the provided sender has been connected and start has been called on the resulting operation state. In other words, the work described by the provided sender
  • If the returned sender is destroyed before execution::connect() is called, or if execution::connect() is called but the returned operation-state is destroyed before execution::start()
  • In such a case, the operation's result will be discarded when it is eventually complete.
  • Note that the application will need to make sure that resources are kept alive in the case that the operation detaches (e.g. by holding a std::shared_ptr