[coroutine.handle.general]

# 17 Language support library [[support]](./#support)

## 17.13 Coroutines [[support.coroutine]](support.coroutine#coroutine.handle.general)

### 17.13.4 Class template coroutine_handle [[coroutine.handle]](coroutine.handle#general)

#### 17.13.4.1 General [coroutine.handle.general]

[ð](#lib:coroutine_handle)

namespace std {template<>struct coroutine_handle<void>{// [[coroutine.handle.con]](coroutine.handle.con "17.13.4.2 Construct/reset"), construct/resetconstexpr coroutine_handle() noexcept; constexpr coroutine_handle(nullptr_t) noexcept;
 coroutine_handle& operator=(nullptr_t) noexcept; // [[coroutine.handle.export.import]](coroutine.handle.export.import "17.13.4.4 Export/import"), export/importconstexpr void* address() const noexcept; static constexpr coroutine_handle from_address(void* addr); // [[coroutine.handle.observers]](coroutine.handle.observers "17.13.4.5 Observers"), observersconstexpr explicit operator bool() const noexcept; bool done() const; // [[coroutine.handle.resumption]](coroutine.handle.resumption "17.13.4.6 Resumption"), resumptionvoid operator()() const; void resume() const; void destroy() const; private:void* ptr; // *exposition only*}; template<class Promise>struct coroutine_handle {// [[coroutine.handle.con]](coroutine.handle.con "17.13.4.2 Construct/reset"), construct/resetconstexpr coroutine_handle() noexcept; constexpr coroutine_handle(nullptr_t) noexcept; static coroutine_handle from_promise(Promise&);
 coroutine_handle& operator=(nullptr_t) noexcept; // [[coroutine.handle.export.import]](coroutine.handle.export.import "17.13.4.4 Export/import"), export/importconstexpr void* address() const noexcept; static constexpr coroutine_handle from_address(void* addr); // [[coroutine.handle.conv]](coroutine.handle.conv "17.13.4.3 Conversion"), conversionconstexpr operator coroutine_handle<>() const noexcept; // [[coroutine.handle.observers]](coroutine.handle.observers "17.13.4.5 Observers"), observersconstexpr explicit operator bool() const noexcept; bool done() const; // [[coroutine.handle.resumption]](coroutine.handle.resumption "17.13.4.6 Resumption"), resumptionvoid operator()() const; void resume() const; void destroy() const; // [[coroutine.handle.promise]](coroutine.handle.promise "17.13.4.7 Promise access"), promise access Promise& promise() const; private:void* ptr; // *exposition only*};}

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L5892)

An object of typecoroutine_handle<T> is called a [*coroutine handle*](#def:coroutine_handle) and can be used to refer to a suspended or executing coroutine[.](#1.sentence-1)

A coroutine_handle object whose
member address() returns a null pointer value
does not refer to any
coroutine[.](#1.sentence-2)

Two coroutine_handle objects refer to the same coroutine
if and only if their member address() returns the same non-null value[.](#1.sentence-3)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L5903)

If a program declares an explicit or partial specialization ofcoroutine_handle, the behavior is undefined[.](#2.sentence-1)
