std::genera...romise_type(3)

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

πŸ’… NAME

std::generator::promise_type β€” bestie, this is literally std::generator::promise_type, the promise type situation for std::generator 🌸 (yes, the C++ Standard Library page, we're in the big leagues now)

This page lives in the C++ Standard Library section of the cppreference man pages β€” ok so now you know where you are, let's go ✨


✨ SYNOPSIS ✨

class generator<Ref, V, Allocator>::promise_type;  (since C++23)

That's it, that's the declaration πŸŽ€ since C++23 β€” so if you're on an older standard, she is not here for you yet, no cap.

The promise type of std::generator. Like, that's her whole job description πŸ’…


🌈 MEMBER FUNCTIONS 🌈

Ok bestie this is the part you actually came for, the whole roster, everybody's here, nobody gets left out 🫢

  • constructor β€” constructs the promise_type object, and note that she's (implicitly declared) and a (public member function) πŸŽ€
  • destructor β€” destroys the promise_type object, also (implicitly declared), also (public member function) πŸ’€
  • get_return_object β€” issues the generator object (public member function) πŸ‘‘
  • initial_suspend β€” issues an awaiter for initial suspend point (public member function) ⭐
  • final_suspend β€” issues an awaiter for final suspend point (public member function) πŸ”₯
  • yield_value β€” processes the object obtained from co_yield (public member function) πŸ“
  • await_transform β€” maps the object obtained from co_await to an awaiter β€” and heads up, this one is marked [deleted] (public member function) πŸ™ˆ iykyk, she's not available
  • return_void β€” handles co_return; or the exit out of coroutine's body (public member function) πŸ’–
  • unhandled_exception β€” processes exceptions that leaked from the coroutine's body (public member function) 😭
  • operator new β€” allocates memory using Allocator, marked [static] and (C++23) (public static member function) ✨
  • operator delete β€” deallocates memory previously obtained from operator new, marked [static] and (C++23) (public static member function) 🧚

πŸ¦‹ EXAMPLE πŸ¦‹

Ok so bestie, I have to be honest with you about this one:

This section is incomplete Reason: no example

Yeah. No example. It's giving "the assignment is due and the doc is empty" 😭 literally nothing to show you here, moving on πŸ’€


πŸ‘‘ SEE ALSO πŸ‘‘

  • noop_coroutine_promise β€” used for coroutines with no observable effects (C++20) (class) 🌸 β€” the lowkey chill one with nothing to prove

πŸ’œ CATEGORY

  • Todo no example

Like, the todo is literally "no example". We been knew πŸ’…


little sign-off bc you deserve it 🌟 β€” this beauty comes to you straight from http://cppreference.com, dated 2024.06.10. Slay, go write a generator, and remember: keep every co_await in check and every co_yield cute πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from