std::atomic_ref::store(3)

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

πŸ’– NAME πŸ’–

std::atomic_ref::store(3) β€” the page from the C++ Standard Libary manual where std::atomic_ref::store lives. Bestie, it's the member that stores a value atomically into the referenced object. Periodt. ✨

πŸ“ Synopsis πŸ“

Here's the exact signature, no edits, iykyk:

          void store( T desired, std::memory_order order =
       (since C++20)
          std::memory_order_seq_cst ) const noexcept;

This one is noexcept, and the (since C++20) note is right there in the signature. It atomically replaces the current value of the referenced object with desired. Memory is affected according to the value of order. πŸ’…

🚨 Warning bestie: order must be one of std::memory_order_relaxed, std::memory_order_release or std::memory_order_seq_cst. Otherwise the behavior is undefined. Not me being dramatic β€” it's literally in the page. πŸ’€

πŸŽ€ Parameters πŸŽ€

  • desired β€” the value to store into the referenced object. πŸ“
  • order β€” memory order constraints to enforce. 🧚

🌈 Return value 🌈

  • (none) β€” literally nothing comes back. Iconic. ✨

πŸ‘€ See also πŸ‘€

  • operator= β€” stores a value into the object referenced by an atomic_ref object (public member function). πŸ’–

Cute sign-off: this page is from http://cppreference.com, dated 2024.06.10, and it's the std::atomic_ref::store(3) page. Bye bestie, go store something atomically. πŸ’œπŸ¦‹

πŸ“¦ where this page comes from