(1) | (since C++11) (member only of atomic<Integral> template specialization) | |
T operator+=( T arg ); | ||
T operator+=( T arg ) volatile; | ||
(1) | (since C++11) (member only of atomic<T*> template specialization) | |
T* operator+=( std::ptrdiff_t arg ); | ||
T* operator+=( std::ptrdiff_t arg ) volatile; | ||
(2) | (since C++11) (member only of atomic<Integral> template specialization) | |
T operator-=( T arg ); | ||
T operator-=( T arg ) volatile; | ||
(2) | (since C++11) (member only of atomic<T*> template specialization) | |
T* operator-=( std::ptrdiff_t arg ); | ||
T* operator-=( std::ptrdiff_t arg ) volatile; | ||
(3) | (since C++11) (member only of atomic<Integral> template specialization) | |
T operator&=( T arg ); | ||
T operator&=( T arg ) volatile; | ||
(4) | (since C++11) (member only of atomic<Integral> template specialization) | |
T operator|=( T arg ); | ||
T operator|=( T arg ) volatile; | ||
(5) | (since C++11) (member only of atomic<Integral> template specialization) | |
T operator^=( T arg ); | ||
T operator^=( T arg ) volatile; |
Atomically replaces the current value with the result of computation involving the previous value and arg
. The operation is read-modify-write operation.
fetch_add(arg)
+ arg.fetch_sub(arg)
- arg.fetch_and(arg)
& arg.fetch_or(arg)
| arg.fetch_xor(arg)
^ arg.For signed Integral
types, arithmetic is defined to use two’s complement representation. There are no undefined results. For T*
types, the result may be an undefined address, but the operations otherwise have no undefined behavior.
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
).
Exceptions
noexcept
specification: noexcept
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.
See also
increments or decrements the atomic value by one (public member function) |
Please login to continue.