std::atomic_ref::operator=(3)

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

🌸 NAME 🌸

Okay so this is the manual page for std::atomic_ref::operator=(3), straight from the C++ Standard Libary β€” yes, that spelling is literally what the page says, bestie πŸ˜­πŸ’…

std::atomic_ref::operator= β€” literally std::atomic_ref::operator= ✨


✨ Synopsis ✨

T operator=( T desired ) const noexcept;             (1) (since C++20)
atomic_ref& operator=( const atomic_ref& ) = delete; (2) (since C++20)
  1. Atomically assigns a value desired to the referenced object. Equivalent to store(desired) πŸ”₯
  2. atomic_ref is not CopyAssignable πŸ’€

πŸŽ€ Parameters πŸŽ€

  • desired β€” value to assign 🫢

πŸ’– Return value πŸ’–

desired β€” yep, it just gives desired right back to you, no cap 🌈


🧚 Notes 🧚

Unlike most assignment operators, the assignment operator for atomic_ref does not return a reference to its left-hand argument 😱

It returns a copy of the stored value instead. That's the plot twist, bestie β€” iconic behavior, honestly πŸ‘‘βœ¨


πŸ‘‘ See also πŸ‘‘

  • constructor β€” constructs an atomic_ref object (public member function) πŸ¦‹

xoxo, source/version: http://cppreference.com β€” date: 2024.06.10 πŸ’‹πŸŽ€

πŸ“¦ where this page comes from