std::genera...inal_suspend(3)

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

πŸŽ€ NAME πŸŽ€

std::generator::promise_type::final_suspend β€” yes bestie, that’s the whole iconic name πŸ’…. This one comes from the C++ Standard Libary manual, and she is very specific about final-suspend business ✨.

🌸 Synopsis 🌸

auto final_suspend() noexcept;  (since C++23)

Okay so let x be some generator object. final_suspend does exactly this, in order:

  1. Pops the coroutine handle from the top of *active_.
  2. If *x.active_ is not empty, resumes execution of the coroutine referred to by x.active_->top(). If it is empty, control flow returns to the current coroutine caller or resumer.
🚨 Big rule, no cap: a handle referring to the coroutine whose promise object is *this must be at the top of *x.active_ of x. This function must be called by the coroutine upon reaching its final suspend point, otherwise the behavior is undefined.

πŸ’… Parameters πŸ’…

  • (none) β€” literally no parameters, bestie. No arguments, no drama, just vibes 🫢.

πŸ¦‹ Return value πŸ¦‹

An awaitable object of unspecified type whose member functions are configured to suspend the calling coroutine ✨.


Mwah πŸ’‹ β€” this gem came from http://cppreference.com, dated 2024.06.10. Stay suspended, bestie πŸŽ€

πŸ“¦ where this page comes from