std::suspend_always(3)
π 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
- 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