std::suspend_always(3)

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

πŸ’… std::suspend_always πŸ’…

okay so bestie, welcome to the std::suspend_always(3) page from the C++ Standard Libary manual β€” yes, that's the manual name, and we're folding it in right here instead of copying the header line. This class is literally giving β€œalways suspend, bestie” main character energy. πŸ¦‹


πŸŽ€ NAME πŸŽ€

std::suspend_always - std::suspend_always (yes, the NAME line says the same thing twice, and honestly? iconic.) ✨

✨ Synopsis ✨

Defined in header <coroutine>:

struct suspend_always;

(since C++20)

suspend_always is an empty class which can be used to indicate that an await expression always suspends and does not produce a value. No cap, that's the whole point. πŸ’…

πŸ’– Member functions πŸ’–

  • await_ready β€” indicates that an await expression always suspends (C++20) (public member function)
  • await_suspend β€” no-op (C++20) (public member function)
  • await_resume β€” no-op (C++20) (public member function)

🌸 std::suspend_always::await_ready 🌸

constexpr bool await_ready() const noexcept { return false; }

(since C++20)

Always returns false, indicating that an await expression always suspends. It's literally saying β€œnope, we're pausing” every single time. 😭

πŸ¦‹ std::suspend_always::await_suspend πŸ¦‹

constexpr void await_suspend( std::coroutine_handle<> ) const noexcept {}

(since C++20)

Does nothing. Like, absolutely nothing. A perfect little no-op. πŸ’€

πŸ“ std::suspend_always::await_resume πŸ“

constexpr void await_resume() const noexcept {}

(since C++20)

Does nothing. An await expression does not produce a value if suspend_always is used. So if you were waiting for a lil return value, bestie, there isn't one. πŸ™ˆ

🌈 Example 🌈

This section is incomplete Reason: no example

πŸ”₯ See also πŸ”₯

  • suspend_never β€” indicates that an await-expression should never suspend (C++20) (class)

🏷️ Category: 🏷️

  • Todo no example

xoxo, your cppreference.com bestie πŸ’‹ β€” source http://cppreference.com, date 2024.06.10, page std::suspend_always(3). 🫢

πŸ“¦ where this page comes from