std::refere...r::operator=(3)

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

πŸ’– std::refere...r::operator=(3) πŸ’–

Ok bestie, we're in the C++ Standard Libary manual today and the main character is std::reference_wrapper::operator=. Yes, that's the title. We're doing this. 🫢

🌸 NAME 🌸

std::reference_wrapper::operator= β€” std::reference_wrapper::operator= ✨

(Yes, same thing twice. It's giving "the function so iconic they named it twice." πŸ’…)

πŸ¦‹ Synopsis πŸ¦‹

Here's the signature exactly as the page lays it out β€” copy assignment energy, since C++11, and constexpr since C++20:

reference_wrapper& operator=( const reference_wrapper&       (since
C++11)
other ) noexcept;
(constexpr since C++20)

Okay so this is the Copy assignment operator. It drops the current reference and stores a reference to other.get(). That's the whole vibe. πŸ”₯

πŸŽ€ Parameters πŸŽ€

  • other β€” reference wrapper to copy. That's it. That's the parameter. πŸ“

πŸ‘‘ Return value πŸ‘‘

  • *this β€” yup, it returns itself. Main character returns main character. πŸ’…

Source/version and date, as promised: this page comes from http://cppreference.com, version 2024.06.10, and the footer date is 2024.06.10. Byeee, go copy-assign something cute πŸ’–βœ¨

πŸ“¦ where this page comes from