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.
T 是 atomic 的模板引數(包含值的型別)。