std::atomic::fetch_sub
来自cppreference.com
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
T fetch_sub( T arg, memory_order = std::memory_order_seq_cst ); |
(atomic<Integral> 模板专业化的成员)(C++11 起) |
|
T* fetch_sub( std::ptrdiff_t arg, memory_order = std::memory_order_seq_cst ); |
(atomic<T*> 模板专业化的成员)(C++11 起) |
|
原子取代的电流值的价值和
arg
算术减法运算的结果。该操作是读 - 修改 - 写操作。记忆的影响根据memory_order
的值.原文:
Atomically replaces the current value with the result of arithmetic subtraction of the value and
arg
. The operation is read-modify-write operation. Memory is affected according to the value of memory_order
.对于有符号的
Integral
类型,算术运算被定义为使用2的补数表示。有原文:
For signed
Integral
types, arithmetic is defined to use two’s complement representation. There是未定义的结果。
T*
类型,其结果可能是未定义的地址,但是操作,否则有未定义的行为.原文:
are no undefined results. For
T*
types, the result may be an undefined address, but the operations otherwise have no undefined behavior.目录 |
[编辑] 参数
arg | - | 其他参数的算术减法
原文: the other argument of arithmetic subtraction |
memory_order | - | 内存顺序的限制,强制执行
|
[编辑] 返回值
原子变量的值在调用前.
原文:
The value of the atomic variable before the call.
[编辑] 例外
[编辑] 另请参阅
(C++11) (C++11) |
减去从一个原子对象的非原子值和获得原子的先前的值 原文: subtracts a non-atomic value from an atomic object and obtains the previous value of the atomic (函数模板) |