std::atomic_ref<T>::operator++,++(int),--,--(int)

Atomically increments or decrements the current value of the referenced object. These operations are read-modify-write operations.

# Declarations

Provided only when T is an integral type other than cv bool or a pointer-to-object type
value_type operator++() const noexcept;

(since C++20)

value_type operator++( int ) const noexcept;

(since C++20)

value_type operator--() const noexcept;

(since C++20)

value_type operator--( int ) const noexcept;

(since C++20)

# Notes

Unlike most pre-increment and pre-decrement operators, the pre-increment and pre-decrement operators for atomic_ref do not return a reference to the modified object. They return a copy of the stored value instead.

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
LWG 3508(P3323R1)C++20increment and decrement operators were meaningless for const Tconstrained to accept only non-const T

# See also