This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

146
cppdraft/coroutine/noop.md Normal file
View File

@@ -0,0 +1,146 @@
[coroutine.noop]
# 17 Language support library [[support]](./#support)
## 17.13 Coroutines [[support.coroutine]](support.coroutine#coroutine.noop)
### 17.13.5 No-op coroutines [coroutine.noop]
#### [17.13.5.1](#coroutine.promise.noop) Class noop_coroutine_promise [[coroutine.promise.noop]](coroutine.promise.noop)
[🔗](#lib:noop_coroutine_promise)
`struct noop_coroutine_promise {};
`
[1](#coroutine.promise.noop-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6158)
The class noop_coroutine_promise defines the promise type for
the coroutine referred to
by noop_coroutine_handle ([[coroutine.syn]](coroutine.syn "17.13.2Header <coroutine> synopsis"))[.](#coroutine.promise.noop-1.sentence-1)
#### [17.13.5.2](#coroutine.handle.noop) Class coroutine_handle<noop_coroutine_promise> [[coroutine.handle.noop]](coroutine.handle.noop)
#### [17.13.5.2.1](#coroutine.handle.noop.general) General [[coroutine.handle.noop.general]](coroutine.handle.noop.general)
[🔗](#lib:coroutine_handle%3cnoop_coroutine_promise%3e)
namespace std {template<>struct coroutine_handle<noop_coroutine_promise>{// [[coroutine.handle.noop.conv]](#coroutine.handle.noop.conv "17.13.5.2.2Conversion"), conversionconstexpr operator coroutine_handle<>() const noexcept; // [[coroutine.handle.noop.observers]](#coroutine.handle.noop.observers "17.13.5.2.3Observers"), observersconstexpr explicit operator bool() const noexcept; constexpr bool done() const noexcept; // [[coroutine.handle.noop.resumption]](#coroutine.handle.noop.resumption "17.13.5.2.4Resumption"), resumptionconstexpr void operator()() const noexcept; constexpr void resume() const noexcept; constexpr void destroy() const noexcept; // [[coroutine.handle.noop.promise]](#coroutine.handle.noop.promise "17.13.5.2.5Promise access"), promise access noop_coroutine_promise& promise() const noexcept; // [[coroutine.handle.noop.address]](#coroutine.handle.noop.address "17.13.5.2.6Address"), addressconstexpr void* address() const noexcept; private: coroutine_handle(*unspecified*); void* ptr; // *exposition only*};}
#### [17.13.5.2.2](#coroutine.handle.noop.conv) Conversion [[coroutine.handle.noop.conv]](coroutine.handle.noop.conv)
[🔗](#lib:operator_coroutine_handle%3c%3e,coroutine_handle%3cnoop_coroutine_promise%3e)
`constexpr operator coroutine_handle<>() const noexcept;
`
[1](#coroutine.handle.noop.conv-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6206)
*Effects*: Equivalent to: return coroutine_handle<>::from_address(address());
#### [17.13.5.2.3](#coroutine.handle.noop.observers) Observers [[coroutine.handle.noop.observers]](coroutine.handle.noop.observers)
[🔗](#lib:operator_bool,coroutine_handle%3cnoop_coroutine_promise%3e)
`constexpr explicit operator bool() const noexcept;
`
[1](#coroutine.handle.noop.observers-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6219)
*Returns*: true[.](#coroutine.handle.noop.observers-1.sentence-1)
[🔗](#lib:done,coroutine_handle%3cnoop_coroutine_promise%3e)
`constexpr bool done() const noexcept;
`
[2](#coroutine.handle.noop.observers-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6230)
*Returns*: false[.](#coroutine.handle.noop.observers-2.sentence-1)
#### [17.13.5.2.4](#coroutine.handle.noop.resumption) Resumption [[coroutine.handle.noop.resumption]](coroutine.handle.noop.resumption)
[🔗](#lib:operator(),coroutine_handle%3cnoop_coroutine_promise%3e)
`constexpr void operator()() const noexcept;
constexpr void resume() const noexcept;
constexpr void destroy() const noexcept;
`
[1](#coroutine.handle.noop.resumption-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6247)
*Effects*: None[.](#coroutine.handle.noop.resumption-1.sentence-1)
[2](#coroutine.handle.noop.resumption-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6251)
*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[.](#coroutine.handle.noop.resumption-2.sentence-1)
#### [17.13.5.2.5](#coroutine.handle.noop.promise) Promise access [[coroutine.handle.noop.promise]](coroutine.handle.noop.promise)
[🔗](#lib:promise,coroutine_handle%3cnoop_coroutine_promise%3e)
`noop_coroutine_promise& promise() const noexcept;
`
[1](#coroutine.handle.noop.promise-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6266)
*Returns*: A reference to the promise object associated with this
coroutine handle[.](#coroutine.handle.noop.promise-1.sentence-1)
#### [17.13.5.2.6](#coroutine.handle.noop.address) Address [[coroutine.handle.noop.address]](coroutine.handle.noop.address)
[🔗](#lib:address,coroutine_handle%3cnoop_coroutine_promise%3e)
`constexpr void* address() const noexcept;
`
[1](#coroutine.handle.noop.address-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6280)
*Returns*: ptr[.](#coroutine.handle.noop.address-1.sentence-1)
[2](#coroutine.handle.noop.address-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6284)
*Remarks*: A noop_coroutine_handle's ptr is always a
non-null pointer value[.](#coroutine.handle.noop.address-2.sentence-1)
#### [17.13.5.3](#coroutine) Function noop_coroutine [[coroutine.noop.coroutine]](coroutine.noop.coroutine)
[🔗](#lib:noop_coroutine)
`noop_coroutine_handle noop_coroutine() noexcept;
`
[1](#coroutine-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6298)
*Returns*: A handle to a coroutine that has no observable effects
when resumed or destroyed[.](#coroutine-1.sentence-1)
[2](#coroutine-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6303)
*Remarks*: A handle returned from noop_coroutine may or may not
compare equal to a handle returned from another invocation
of noop_coroutine[.](#coroutine-2.sentence-1)