std::shared...e::operator=(3)

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

πŸ’… std::shared...e::operator=(3) πŸ’…

okay bestie, welcome to the C++ Standard Libary manual β€” yes, that’s the manual name, typo and all, and we are obsessed with the chaos. This page is all about std::shared_future::operator=, the assignment operator, and it’s giving very specific overload energy. 🫢


πŸŽ€ NAME πŸŽ€

std::shared_future::operator= β€” literally std::shared_future::operator=. No cap, that’s the name.


✨ Synopsis ✨

The source synopsis has line wrapping doing the absolute most, so here are the exact signatures and annotations, bestie:

shared_future& operator=( const shared_future& other );
(since C++11)
(until
C++17)
shared_future& operator=( const shared_future& other )         (1)
(since C++17)
noexcept;
shared_future& operator=( shared_future&& other ) noexcept;
(2) (since C++11)

(Yes, noexcept; is sitting on its own line in the source. I am not editing the sacred text. πŸ’€)


Okay so what does it actually do? It assigns the contents of another shared_future. The two overloads are giving different energy:

  1. Releases any shared state and assigns the contents of other to *this. After the assignment, this->valid() == other.valid(). Slay.
  2. 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. The move is moving, periodt.

πŸ“ Parameters πŸ“

  • other β€” a std::shared_future that will transfer state to *this. That’s the whole parameter list, bestie.

πŸ‘‘ Return value πŸ‘‘

*this. That’s it. It returns *this, and honestly that’s main character energy. ✨


mwah πŸ’‹ this page is from http://cppreference.com, dated 2024.06.10, and it’s std::shared...e::operator=(3). bye bestie, go assign responsibly πŸ«ΆπŸ’–

πŸ“¦ where this page comes from