C++ 参考手册
- C++11
- C++14
- C++17
- C++20
- C++ 编译器支持情况表
- 独立与宿主实现
- C++ 语言
- C++ 关键词
- 预处理器
- C++ 标准库头文件
- 具名要求
- 功能特性测试 (C++20)
- 工具库
- 类型支持(基本类型、RTTI、类型特性)
- 概念库 (C++20)
- 错误处理
- 动态内存管理
- 日期和时间工具
- 字符串库
- 容器库
- 迭代器库
- 范围库 (C++20)
- 算法库
- 数值库
- 输入/输出库
- 文件系统库
- 本地化库
- 正则表达式库
- 原子操作库
- std::atomic
- std::atomic<T>::atomic
- std::atomic<T>::operator=
- std::atomic<T>::is_lock_free
- std::atomic<T>::is_always_lock_free
- std::atomic<T>::store
- std::atomic<T>::load
- std::atomic<T>::operator T()
- std::atomic<T>::exchange
- std::atomic<T>::compare_exchange_weak, std::atomic<T>::compare_exchange_strong
- std::atomic<T>::wait
- std::atomic<T>::notify_one
- std::atomic<T>::notify_all
- std::atomic<T>::fetch_add
- std::atomic<T>::fetch_sub
- std::atomic<T>::fetch_and
- std::atomic<T>::fetch_or
- std::atomic<T>::fetch_xor
- std::atomic<T>::operator++,++(int),--,--(int)
- std::atomic<T>::operator+=,-=,&=,|=,^=
- std::atomic_store, std::atomic_store_explicit
- std::atomic_load, std::atomic_load_explicit
- std::atomic_exchange, std::atomic_exchange_explicit
- std::atomic_flag
- std::atomic_ref
- std::atomic_compare_exchange_weak, std::atomic_compare_exchange_strong, std::atomic_compare_exchange_weak_explicit, std::atomic_compare_exchange_strong_explicit
- std::atomic_fetch_add, std::atomic_fetch_add_explicit
- std::atomic_fetch_sub, std::atomic_fetch_sub_explicit
- std::atomic_fetch_and, std::atomic_fetch_and_explicit
- std::atomic_fetch_or, std::atomic_fetch_or_explicit
- std::atomic_fetch_xor, std::atomic_fetch_xor_explicit
- std::atomic_is_lock_free, ATOMIC_xxx_LOCK_FREE
- std::atomic_wait, std::atomic_wait_explicit
- std::atomic_notify_one
- std::atomic_notify_all
- std::atomic_flag_test_and_set, std::atomic_flag_test_and_set_explicit
- std::atomic_flag_clear, std::atomic_flag_clear_explicit
- std::atomic_flag_test, std::atomic_flag_test_explicit
- std::atomic_flag_wait, std::atomic_flag_wait_explicit
- std::atomic_flag_notify_one
- std::atomic_flag_notify_all
- std::atomic_init
- ATOMIC_VAR_INIT
- ATOMIC_FLAG_INIT
- std::memory_order
- std::kill_dependency
- std::atomic_thread_fence
- std::atomic_signal_fence
- 注释
- 线程支持库
- 实验性 C++ 特性
- 有用的资源
- 索引
- std 符号索引
- 协程支持 (C++20)
- C++ 关键词
位置:首页 > C++ 参考手册 >原子操作库 >std::atomic > std::atomic<T>::fetch_and
std::atomic<T>::fetch_and
(C++11 起) (仅为 atomic<Integral> 模板特化的成员) |
||
T fetch_and( T arg, std::memory_order order = std::memory_order_seq_cst ) noexcept; |
||
T fetch_and( T arg, std::memory_order order = std::memory_order_seq_cst ) volatile noexcept; |
||
原子地以值和 arg
逐位与的结果替换当前值。运算是读修改写操作。按照 order
的值影响内存。
参数
arg | - | 逐位与的另一参数 |
order | - | 强制的内存顺序制约 |
返回值
*this
的修改顺序中立即前趋此函数效果的值。
参阅
(C++11)(C++11) |
将原子对象替换为与非原子实参逻辑与的结果,并获得原子对象的先前值 (函数模板) |