public member function


pre-decrement (1)
T operator--() volatile noexcept;T operator--() noexcept;
post-decrement (2)
T operator-- (int) volatile noexcept;T operator-- (int) noexcept;
Decrement container value
Decrements the value of the contained value and returns the resulting contained value (1) or the value it had immediately before the operation (2).

The entire operation is atomic: the value cannot be modified between the instant its value is read and the moment it is modified by this function.

This function behaves as if atomic::fetch_sub was called with 1 and memory_order_seq_cst as arguments.

The function is only defined in the atomic specializations for integral and pointer types (except for bool).


none (the second version overloads the post-decrement operator).

Return value

The contained value after (1) or before (2) the call.
T is atomic's template parameter (the type of the contained value).

Data races

No data races (atomic operation). The operation uses sequential consistency (memory_order_seq_cst).

Exception safety

No-throw guarantee: never throws exceptions.

See also