std::atomic_fetch_and, std::atomic_fetch_and_explicit
来自cppreference.com
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
在头文件 <atomic> 中定义
|
||
template< class Integral > Integral atomic_fetch_and( std::atomic<Integral>* obj, Integral arg ); |
(1) | (C++11 起) |
template< class Integral > Integral atomic_fetch_and( volatile std::atomic<Integral>* obj, Integral arg ); |
(2) | (C++11 起) |
template< class Integral > Integral atomic_fetch_and_explicit( std::atomic<Integral>* obj, Integral arg, |
(3) | (C++11 起) |
template< class Integral > Integral atomic_fetch_and_explicit( volatile std::atomic<Integral>* obj, Integral arg, |
(4) | (C++11 起) |
原子取代所指向的数值
3-4) arg
,按位与的结果之间的旧值obj
arg
,并返回值obj
举行之前,如果由obj->fetch_and(arg)原文:
Atomically replaces the value pointed by
arg
with the result of bitwise AND between the old value of obj
and arg
, and returns the value obj
held previously, as if by obj->fetch_and(arg)原子取代所指向的数值
arg
,按位与的结果之间的旧值obj
arg
,并返回值obj
举行之前,如果由obj->fetch_and(arg, order)原文:
Atomically replaces the value pointed by
arg
with the result of bitwise AND between the old value of obj
and arg
, and returns the value obj
held previously, as if by obj->fetch_and(arg, order)目录 |
[编辑] 参数
obj | - | 指针的原子对象修改
原文: pointer to the atomic object to modify |
arg | - | 按位AND原子对象中存储的值的值
原文: the value to bitwise AND to the value stored in the atomic object |
order | - | 内存同步进行此操作的顺序:所有的允许值.
原文: the memory synchronization ordering for this operation: all values are permitted. |
[编辑] 返回值
以前保存的值的原子对象所指向的
obj
原文:
The value held previously by the atomic object pointed to by
obj
[编辑] 例外
[编辑] 可能的实现
template< class T > typename std::enable_if<std::is_integral<T>::value && !std::is_same<T, bool>::value, T>::type atomic_fetch_and(std::atomic<T>* obj, T arg); { return obj->fetch_and(arg); } |
[编辑] 示例
本章尚未完成 原因:暂无示例 |
[编辑] 另请参阅
(C++11) |
以原子方式执行按位“与”之间的参数的值的原子对象,并获得先前保存的值 原文: atomically performs bitwise AND between the argument and the value of the atomic object and obtains the value held previously (公共成员函数of std::atomic )
|
(C++11) (C++11) |
取代的原子的对象的逻辑结果,或与非原子参数获得原子的先前的值 原文: replaces the atomic object with the result of logical OR with a non-atomic argument and obtains the previous value of the atomic (函数模板) |
(C++11) (C++11) |
取代的原子的对象与非原子参数的逻辑异或的结果和获得原子的先前的值 原文: replaces the atomic object with the result of logical XOR with a non-atomic argument and obtains the previous value of the atomic (函数模板) |
C documentation for atomic_fetch_and, atomic_fetch_and_explicit
|