std::coroutine_handle<Promise>::promise

From cppreference.com
Utilities library
General utilities
Relational operators (deprecated in C++20)
Integer comparison functions
(C++20)(C++20)(C++20)
(C++20)
Swap and type operations
(C++20)
(C++14)
(C++11)
(C++23)
(C++11)
(C++23)
(C++11)
(C++17)
Common vocabulary types
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++11)
(C++17)
(C++17)
(C++23)



Coroutine support
Coroutine traits
Coroutine handle
No-op coroutines
(C++20)
Trivial awaitables
(C++20)
(C++20)
Range generators
(C++23)
Member of the primary template
Promise& promise() const;
(since C++20)
Member of specialization std::coroutine_handle<std::noop_coroutine_promise>
std::noop_coroutine_promise & promise( ) const noexcept ;
(since C++20)

Obtains a reference to the promise object.

The behavior is undefined if *this does not refer to a coroutine whose promise object has not been destroyed.

This function is not provided for the specialization std::coroutine_handle<>

Parameters

(none)

Return value

A reference to the promise object.

Notes

The promise object of a no-op coroutine is not destroyed as long as there is some std::noop_coroutine_handle referring to the coroutine.

See also

[static]
creates a coroutine_handle from the promise object of a coroutine
(public static member function)