std::corout...from_address(3)

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

πŸ’– NAME πŸ’–

std::coroutine_handle::from_address β€” yep, that's the name, and it's literally std::coroutine_handle::from_address. We're in the C++ Standard Libary manual, bestie, and this function is here to turn an address into a coroutine handle. Slay.

✨ Synopsis ✨

static constexpr coroutine_handle from_address( void *addr );

(since C++20)

Creates a coroutine_handle from a null pointer value or an underlying address of another coroutine_handle. The underlying address of the return value is addr.

🚨 Undefined behavior warning, no cap: behavior is undefined if addr is neither a null pointer value nor an underlying address of a coroutine_handle. Behavior is also undefined if addr is an underlying address of a std::coroutine_handle<P1>, where both Promise and P1 are not void, and P1 is different from Promise. Like, do not play with that. 😭

This function is not declared for the specialization std::coroutine_handle<std::noop_coroutine_promise>.

πŸŽ€ Parameters πŸŽ€

  • addr β€” underlying address to import.

πŸ¦‹ Return value πŸ¦‹

A std::coroutine_handle<Promise> whose underlying address is addr.

🌸 Notes 🌸

If addr is not a null pointer value, it must be obtained from a prior call to address() on a coroutine_handle referring to some coroutine. That's the vibe check: get it from a real prior address() call, bestie.

🌈 Example 🌈

This section is incomplete.

Reason: no example.

πŸ’… See also πŸ’…

  • constructor β€” constructs a coroutine_handle object (C++20) (public member function)
  • from_promise β€” creates a coroutine_handle from the promise object of a coroutine [static] (C++20) (public static member function)
  • noop_coroutine β€” creates a coroutine handle that has no observable effects when resumed or destroyed (C++20) (function)

⭐ Category ⭐

  • Todo no example

That's the whole page, bestie! Big thank-you to cppreference.com for the source, dated 2024.06.10 β€” mwah πŸ’‹βœ¨πŸ‘‘

πŸ“¦ where this page comes from