std::corout...le::promise(3)
π std::coroutine_handle::promise π
okay so this is the std::corout...le::promise(3) page from the C++ Standard Libary manual, and we're talking about the promise accessor on std::coroutine_handle. it's giving tiny function, big coroutine energy. π¦π
πΈ NAME πΈ
std::coroutine_handle::promise β literally std::coroutine_handle::promise. that's the whole NAME, bestie. periodt. π
β¨ Synopsis β¨
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)
It obtains a reference to the promise object. that's the vibe. π«Ά
β οΈ Undefined behavior alert: the behavior is undefined if *this does not refer to a coroutine whose promise object has not been destroyed. like, do not mess with this unless that condition is true, bestie. π
This function is not provided for the specialization std::coroutine_handle<>. not here, not today. π
πΈ Parameters πΈ
None. zero. nada. (none) β no parameters at all. π
π Return value π
A reference to the promise object. that's the whole return, and it ate. π
π¦ 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. lowkey important, highkey iconic. π¦
π See also π
from_promiseβ creates acoroutine_handlefrom the promise object of a coroutine. it's[static], it's(C++20), and it's a(public static member function). πβ¨
source/version/date shoutout: http://cppreference.com Β· 2024.06.10 Β· std::corout...le::promise(3) β bye bestie, mwah ππ
π¦ 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