std::atomic_ref::fetch_xor(3)

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

πŸŽ€ NAME πŸŽ€ β€” std::atomic_ref::fetch_xor(3)

okay so this is the std::atomic_ref::fetch_xor page from the C++ Standard Libary manual πŸ’… (yes bestie, that's the manual name up top). The function itself is std::atomic_ref::fetch_xor β€” std::atomic_ref::fetch_xor, periodt.

πŸ”₯ Synopsis πŸ”₯

it's a member only of atomic_ref<Integral> specializations, and the signature is giving exactly this:

member only of atomic_ref<Integral> specializations

T fetch_xor( T arg,
             std::memory_order order = std::memory_order_seq_cst )
(since C++20)
const noexcept;

so what does it do? Atomically replaces the current value of the referenced object with the result of bitwise XOR of the value and arg. This operation is a read-modify-write operation. Memory is affected according to the value of order ✨.

πŸŽ€ Parameters πŸŽ€

  • arg β€” the other argument of bitwise XOR. that's the second little XOR bestie in the mix πŸ’…
  • order β€” memory order constraints to enforce. it's the memory-ordering vibe check 🫢

πŸ’– Return value πŸ’–

The value of the referenced object, immediately preceding the effects of this function. so you get the value from right before this function did its thing, no cap πŸ˜­πŸ‘‘


source: http://cppreference.com Β· date: 2024.06.10 Β· page: std::atomic_ref::fetch_xor(3) β€” mwah, bestie πŸ’‹πŸ’…

πŸ“¦ where this page comes from