std::packag...:get_future(3)

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

πŸ’… NAME

std::packaged_task::get_future β€” ok so this is literally the std::packaged_task::get_future page, bestie, coming at you straight from the C++ Standard Libary manual πŸ¦‹


✨ Synopsis

Here's the whole vibe, one line, no cap:

std::future<R> get_future();  (since C++11)

So what does it actually do? It returns a future which shares the same shared state as *this 🫢 That's it. That's the whole personality.

⚠️ But bestie listen β€” get_future can be called only once for each packaged_task. Not twice. Not "oops let me try again." Once. Periodt. πŸ’…

πŸŽ€ Parameters

(none) β€” she takes nothing! No arguments, no drama, iconic behavior honestly 🌸


🌸 Return value

A future which shares the same shared state as *this ✨ (yes, same sentence as the synopsis β€” cppreference said it twice so we're saying it twice, consistency queen πŸ‘‘)


πŸ’€ Exceptions

If things go sideways, you get a std::future_error on the following error conditions:

  • The shared state has already been retrieved via a call to get_future. The error category is set to future_already_retrieved. 😭 (you already asked, girl, she's not gonna give it twice)
  • *this has no shared state. The error category is set to no_state. πŸ’€ (there's literally nothing there to share β€” vibe check failed)

anyway that's the whole page, mwah πŸ’– shoutout to http://cppreference.com for hosting this, dated 2024.06.10 β€” go drink some water and go call get_future exactly once, iykyk πŸ§šβ€β™€οΈπŸ«Ά

πŸ“¦ where this page comes from