std::atomic...ator&=,|=,^=(3)
β¨ NAME β¨
okay so bestie, welcome to the std::atomic...ator&=,|=,^=(3) manual page from the C++ Standard Libary π
this one is all about std::atomic::operator&=,|=,^= β yes, the name is literally std::atomic::operator&=,|=,^= on both sides of the dash, and honestly? iconic. π
πΈ Synopsis πΈ
This is member only of atomic<Integral > specializations, so keep that in mind before you try to make it do something it is not supposed to do, bestie. π«Ά
member only of atomic<Integral > specializations
T operator&=( T arg ) noexcept; (1) (since C++11)
T operator&=( T arg ) volatile noexcept; (2) (since C++11)
T operator|=( T arg ) noexcept; (3) (since C++11)
T operator|=( T arg ) volatile noexcept; (4) (since C++11)
T operator^=( T arg ) noexcept; (5) (since C++11)
T operator^=( T arg ) volatile noexcept; (6) (since C++11)
Atomically replaces the current value with the result of computation involving the previous value and arg. The operation is a read-modify-write operation. π₯
operator&=performs atomic bitwise and. Equivalent toreturn fetch_and(arg) & arg;.operator|=performs atomic bitwise or. Equivalent toreturn fetch_or(arg) | arg;.operator^=performs atomic bitwise exclusive or. Equivalent toreturn fetch_xor(arg) ^ arg;.
β οΈ it is deprecated ifstd::atomic<T>::is_always_lock_freeis false and (since C++20) anyvolatileoverload participates in overload resolution. like, that's the rule, no cap. π
π Parameters π
argβ the argument for the arithmetic operation
π Return value π
The resulting value (that is, the result of applying the corresponding binary operator to the value immediately preceding the effects of the corresponding member function in the modification order of *this). β¨
π¦ Notes π¦
Unlike most compound assignment operators, the compound assignment operators for atomic types do not return a reference to their left-hand arguments. They return a copy of the stored value instead. yep, that's the vibe check, and it passed. π
π See also π
fetch_andβ atomically performs bitwise AND between the argument and the value of the atomic object and obtains the value held previously (public member function)fetch_orβ atomically performs bitwise OR between the argument and the value of the atomic object and obtains the value held previously (public member function)fetch_xorβ atomically performs bitwise XOR between the argument and the value of the atomic object and obtains the value held previously (public member function)operator++,operator++(int),operator--,operator--(int)β increments or decrements the atomic value by one (public member function)operator+=,operator-=β adds to or subtracts from the atomic value (public member function)
and that's the page, bestie π§π shoutout to the footer: source is http://cppreference.com, date/version is 2024.06.10, and the manual tag is std::atomic...ator&=,|=,^=(3) β slay, bye! πβ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms