public member function
<atomic>

std::atomic::operator--

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).

返回值

The contained value after (1) or before (2) the call.
Tatomic 的模板参数(包含值的类型)。

数据竞争

无数据竞争(原子操作)。该操作使用*顺序一致性*(memory_order_seq_cst)。

异常安全

无异常保证: 绝不抛出异常。

另见