[coroutine.noop] (original) (raw)

17 Language support library [support]

17.12 Coroutines [support.coroutine]

17.12.4 No-op coroutines [coroutine.noop]

17.12.4.1 Class noop_­coroutine_­promise [coroutine.promise.noop]

struct noop_coroutine_promise {};

The class noop_­coroutine_­promise defines the promise type for the coroutine referred to by noop_­coroutine_­handle ([coroutine.syn]).

17.12.4.2 Class coroutine_­handle<noop_­coroutine_­promise> [coroutine.handle.noop]

namespace std { template<> struct coroutine_handle : coroutine_handle<> {

constexpr explicit operator bool() const noexcept;
constexpr bool done() const noexcept;


constexpr void operator()() const noexcept;
constexpr void resume() const noexcept;
constexpr void destroy() const noexcept;


noop_coroutine_promise& promise() const noexcept;


constexpr void* address() const noexcept;

private: coroutine_handle(unspecified); }; }

17.12.4.2.2 Resumption [coroutine.handle.noop.resumption]

constexpr void operator()() const noexcept;constexpr void resume() const noexcept;constexpr void destroy() const noexcept;

Remarks:If noop_­coroutine_­handle is converted to coroutine_­handle<>, calls to operator(), resume and destroy on that handle will also have no observable effects.

17.12.4.2.3 Promise access [coroutine.handle.noop.promise]

noop_coroutine_promise& promise() const noexcept;

Returns:A reference to the promise object associated with this coroutine handle.

17.12.4.3 Function noop_­coroutine [coroutine.noop.coroutine]

noop_coroutine_handle noop_coroutine() noexcept;

Returns:A handle to a coroutine that has no observable effects when resumed or destroyed.

Remarks:A handle returned from noop_­coroutine may or may not compare equal to a handle returned from another invocation of noop_­coroutine.