std::future::operator=(3)

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

πŸ’– NAME πŸ’–

okay so bestie, this is the <pink>std::future::operator=</pink> page β€” page (3), from the C++ Standard Libary manual β€” and it’s literally all about assigning one std::future to another. slay. ✨


πŸ¦‹ Synopsis πŸ¦‹

future& operator=( future&& other ) noexcept;      (1) (since C++11)
future& operator=( const future& other ) = delete; (2) (since C++11)

Assigns the contents of another future object. yes bestie, that’s the whole assignment vibe. πŸ’…

  1. Number 1, the move-assign era β€” releases any shared state and move-assigns the contents of other to *this. After the assignment, other.valid() == false and this->valid() will yield the same value as other.valid() before the assignment. iconic behavior, honestly. πŸŽ€
  2. Number 2, the deleted copy-assign one β€” std::future is not CopyAssignable. like, not even a little bit. πŸ’€
bestie, do not try to copy-assign a std::future β€” that one is = delete, periodt. πŸ™ˆ

🌸 Parameters 🌸

  • other β€” a std::future that will transfer state to *this. she’s giving main character energy and handing over the state. πŸ¦‹

πŸŽ€ Return value πŸŽ€

*this

that’s it. that’s the return. no cap. ✨


that’s the whole vibe, bestie πŸ’… β€” this one’s from cppreference.com, dated/versioned 2024.06.10. mwah 🫢

πŸ“¦ where this page comes from