std::experi...damentalsTS)(3)

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

hey bestie πŸ’– you're reading std::experi...damentalsTS)(3) from the C++ Standard Libary manual, and ngl we're gonna make it make sense. no cap.

🌸 NAME 🌸

okay so the NAME line is literally std::experimental::promise(libraryfundamentalsTS) - std::experimental::promise(libraryfundamentalsTS). yep, same string twice, it's giving main character energy πŸ’….

✨ Synopsis ✨

first thing: this whole thing is defined in header <experimental/future> πŸ¦‹

template< class R > class promise;       (1) (library fundamentals TS)
template< class R > class promise<R&>;   (2) (library fundamentals TS)
template<>          class promise<void>; (3) (library fundamentals TS)

so std::experimental::fundamentals_v1::promise (and std::experimental::fundamentals_v2::promise) is a modified version of std::promise provided by the library fundamentals TS with support for type-erased allocators. fr fr ✨

πŸŽ€ Member types πŸŽ€

  • Member type: allocator_type β€” Definition: std::experimental::erased_type. cute.

πŸ’… Member functions πŸ’…

  • constructor β€” constructs the promise object (public member function).
  • get_memory_resource β€” retrieves a pointer to the memory resource used by this object to allocate memory (public member function).

πŸ¦‹ Non-member function πŸ¦‹

  • std::experimental::swap(std::experimental::promise) β€” specializes the swap algorithm (function template).

🧚 Helper classes 🧚

  • std::uses_allocator<std::experimental::promise> β€” specializes the std::uses_allocator type trait (class template specialization).

🫢 Members identical to std::promise 🫢

vibe check: these ones are literally identical to std::promise, so you already know the drill:

πŸ’… Member functions πŸ’…

  • destructor β€” destructs the promise object (public member function of std::promise<R>).
  • operator= β€” assigns the shared state (public member function of std::promise<R>).
  • swap β€” swaps two promise objects (public member function of std::promise<R>).

🌈 Getting the result 🌈

  • get_future β€” returns a future associated with the promised result (public member function of std::promise<R>).

πŸ”₯ Setting the result πŸ”₯

  • set_value β€” sets the result to specific value (public member function of std::promise<R>).
  • set_value_at_thread_exit β€” sets the result to specific value while delivering the notification only at thread exit (public member function of std::promise<R>).
  • set_exception β€” sets the result to indicate an exception (public member function of std::promise<R>).
  • set_exception_at_thread_exit β€” sets the result to indicate an exception while delivering the notification only at thread exit (public member function of std::promise<R>).

okay bestie, that's the whole manual page, slay πŸ’– source: http://cppreference.com, dated 2024.06.10. mwah 🫢

πŸ“¦ where this page comes from