在线文档教程
C++

std::atomic::fetch_sub

STD::原子::获取[医]分

(since C++11) (member only of atomic template specialization)
T fetch_sub( T arg, std::memory_order order = std::memory_order_seq_cst
T fetch_sub( T arg, std::memory_order order = std::memory_order_seq_cst ) volatile;
(since C++11) (member only of atomic<T*> template specialization)
T* fetch_sub( std::ptrdiff_t arg, std::memory_order order = std::memory_order_seq_cst
T* fetch_sub( std::ptrdiff_t arg, std::memory_order order = std::memory_order_seq_cst ) volatile;

将当前值替换为值的算术减法结果,arg.操作是读-修改-写操作.。的值影响内存。order...

签名Integral类型,算法定义为使用两种补码表示形式。没有未定义的结果。为T*类型,结果可能是一个未定义的地址,但否则操作就没有未定义的行为。

参数

arg-the other argument of arithmetic subtraction
order-memory order constraints to enforce

返回值

中此函数的效果之前的值。修改顺序成*this...

例外

noexcept规格:

noexcept

另见

atomic_fetch_subatomic_fetch_sub_explicit (C++11)(C++11)subtracts a non-atomic value from an atomic object and obtains the previous value of the atomic (function template)

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cpPreference.com/w/cpp/原子/原子/FETCH[医]分