std::suspend_never

From cppreference.com
< cpp‎ | coroutine
 
 
Utilities library
General utilities
Date and time
Function objects
Formatting library (C++20)
(C++11)
Relational operators (deprecated in C++20)
Integer comparison functions
(C++20)(C++20)(C++20)   
(C++20)
Swap and type operations
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
Common vocabulary types
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)
Elementary string conversions
(C++17)
(C++17)
 
Coroutine support
Coroutine traits
Coroutine handle
No-op coroutines
Trivial awaitables
suspend_never
(C++20)
 
Defined in header <coroutine>
struct suspend_never;
(since C++20)

suspend_never is an empty class which can be used to indicate that an await expression never suspends and does not produce a value.

Member functions

await_ready
(C++20)
indicates that an await expression never suspends
(public member function)
await_suspend
(C++20)
no-op
(public member function)
await_resume
(C++20)
no-op
(public member function)

std::suspend_never::await_ready

constexpr bool await_ready() const noexcept { return true; }
(since C++20)

Always returns true, indicating that an await expression never suspends.

std::suspend_never::await_suspend

constexpr void await_suspend(std::coroutine_handle<>) const noexcept {}
(since C++20)

Does nothing.

std::suspend_never::await_resume

constexpr void await_resume() const noexcept {}
(since C++20)

Does nothing. An await expression does not produce a value if suspend_never is used.

Example

See also

indicates that an await-expression should always suspend
(class)