std::corout...handle::done(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

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 β€” literally std::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. 1) Returns true if the coroutine to which *this refers is suspended at its final suspend point, or false if the coroutine is suspended at other suspend points. The behavior is undefined if *this does 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. 2) Always returns false. That’s it. That’s the whole function.

Parameters πŸŽ€

  • (none) β€” no parameters, zero, nada, the cleanest argument list. 🫢

Return value πŸ’–

  1. 1) true if the coroutine is suspended at its final suspend point, false if the coroutine is suspended at other suspend points.
  2. 2) false.

Notes πŸ“

A no-op coroutine is always considered not suspended at its final suspended point.

Example 🌸

This section is incomplete Reason: no example

Category: 🏷️

  • * Todo no example

mwah πŸ’‹ source/version: http://cppreference.com, dated 2024.06.10. periodt. πŸ‘‘

πŸ“¦ where this page comes from