std::corout...handle::done(3)
std::corout...handle::done(3) π
okay so bestie, welcome to the std::corout...handle::done page from the C++ Standard Libary manual (yes, thatβs the spelling in the source, no cap). This is the vibe check for a suspended coroutine: are you parked at your final suspend point or not? Letβs get into it. π¦
NAME β¨
std::coroutine_handle::doneβ literallystd::coroutine_handle::done, thatβs the whole name, iconic.
Synopsis π¦
Hereβs the synopsis, copied exactly because we do not mess with signatures in this house:
Member of other specializations
bool done() const;
(1) (since C++20)
Member of specialization
std::coroutine_handle<std::noop_coroutine_promise>
constexpr bool done() const noexcept;
(2) (since C++20)
It checks if a suspended coroutine is suspended at its final suspended point. No, thatβs not a typo, thatβs the sentence. π
1)Returnstrueif the coroutine to which*thisrefers is suspended at its final suspend point, orfalseif the coroutine is suspended at other suspend points. The behavior is undefined if*thisdoes not refer to a suspended coroutine. So yeah, do not call this on a non-suspended coroutine, bestie β undefined behavior is not the moment.2)Always returnsfalse. Thatβs it. Thatβs the whole function.
Parameters π
(none)β no parameters, zero, nada, the cleanest argument list. π«Ά
Return value π
1)trueif the coroutine is suspended at its final suspend point,falseif the coroutine is suspended at other suspend points.2)false.
Notes π
A no-op coroutine is always considered not suspended at its final suspended point.
Example πΈ
This section is incompleteReason: no example
Category: π·οΈ
- * Todo no example
mwah π source/version: http://cppreference.com, dated 2024.06.10. periodt. π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms