std::atomic_fetch_xor, std::atomic_fetch_xor_explicit

定义于头文件 <atomic>
(1) (C++11 起)
template< class Integral >
Integral atomic_fetch_xor( std::atomic<Integral>* obj, Integral arg ) noexcept;
template< class Integral >
Integral atomic_fetch_xor( volatile std::atomic<Integral>* obj, Integral arg ) noexcept;
(2) (C++11 起)
template< class Integral >

Integral atomic_fetch_xor_explicit( std::atomic<Integral>* obj, Integral arg,

                                    std::memory_order order ) noexcept;
template< class Integral >

Integral atomic_fetch_xor_explicit( volatile std::atomic<Integral>* obj, Integral arg,

                                    std::memory_order order ) noexcept;

原子地以 obj 的旧值和 arg 的逐位异或结果替换 obj 所指向的值。返回 obj 先前保有的值。

如同执行下列内容一般进行运算:

1) obj->fetch_xor(arg)
2) obj->fetch_xor(arg, order)

目录

参数

obj - 指向要修改的原子对象的指针
arg - 要和存储于原子对象的值逐位异或的值
order - 此操作所用的内存同步书顺序:容许所有值。

返回值

*obj修改顺序中立即前趋此函数效果的值。

可能的实现

template< class T >
typename std::enable_if<std::is_integral<T>::value && !std::is_same<T, bool>::value, T>::type
atomic_fetch_xor( std::atomic<T>* obj, T arg );
{
    return obj->fetch_xor(arg);
}

示例

参阅

原子地进行参数和原子对象的值的逐位异或,并获得先前保有的值
(std::atomic 的公开成员函数)
将原子对象替换为与非原子参数逻辑或的结果,并获得原子对象的先前值
(函数模板)
将原子对象替换为与非原子参数的逻辑与结果,并获得原子对象的先前值
(函数模板)
atomic_fetch_xor, atomic_fetch_xor_explicitC 文档

版本历史

  • (当前 | 先前 2017年10月15日 (日) 06:01Fruderica讨论 | 贡献. . (2,118字节) (-1,029). . (撤销)
  • 当前 | 先前 2014年10月26日 (日) 16:41P12bot讨论 | 贡献 . . (3,147字节) (0). . (Fix some translations) (撤销)
  • 当前 | 先前 2013年7月2日 (二) 07:18P12bot讨论 | 贡献 . . (3,147字节) (-232). . (Use {{lc}}. Update links. Various fixes.) (撤销)
  • 当前 | 先前 2012年11月2日 (五) 16:27P12bot讨论 | 贡献 . . (3,379字节) (+281). . (r2.7.3) (机器人添加:de, en, es, fr, it, ja, pt, ru) (撤销)
  • 当前 | 先前 2012年10月26日 (五) 09:22P12讨论 | 贡献 . . (3,098字节) (0). . (1个修订: Translate from the English version) (撤销)
  • 当前 | 先前 2012年10月26日 (五) 06:00TranslationBot讨论 | 贡献. . (3,098字节) (-70). . (Translated from the English version using Google Translate) (撤销)
  • 当前 | 先前 2012年10月25日 (四) 13:13P12讨论 | 贡献 . . (3,168字节) (0). . (1个修订: Translate from the English version) (撤销)
  • 当前 | 先前) 2012年10月25日 (四) 12:00TranslationBot讨论 | 贡献. . (3,168字节) (+3,168). . (Translated from the English version using Google Translate)