std::swap(std::promise)(3)

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

hey bestie, welcome to std::swap(std::promise)(3) πŸ’– this one lives in the C++ Standard Libary manual, and we’re about to make a very niche swap situation make sense, no cap ✨

🌸 NAME 🌸

std::swap(std::promise) β€” std::swap(std::promise) 🫢 yes, the name section is doing name-on-name realness, and honestly? iconic πŸ’…

✨ Synopsis ✨

Defined in header <future> 🌸

template< class R >
void swap( promise<R>& lhs, promise<R>& rhs ) noexcept;

This bad boy is since C++11 πŸ‘‘ it specializes the std::swap algorithm for std::promise. It exchanges the shared state of lhs with that of rhs, and effectively calls lhs.swap(rhs) ✨

πŸŽ€ Parameters πŸŽ€

  • lhs, rhs β€” promises whose states to swap πŸ¦‹

πŸ¦‹ Return value πŸ¦‹

(none) β€” literally nothing comes back, bestie, it just does the swap and vibes 😌

🌈 Example 🌈

This section is incomplete Reason: no example

not me leaving the example slot empty 😭 but fr fr, that’s what the page says 🫢

πŸ‘€ See also πŸ‘€

  • swap β€” swaps two promise objects (public member function) πŸ’«

πŸ“Œ Category πŸ“Œ

  • * Todo no example πŸ“

xoxo, your source/version is http://cppreference.com, dated 2024.06.10, and this manual page is std::swap(std::promise)(3) πŸ’…βœ¨

πŸ“¦ where this page comes from