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>::atomic
std::atomic<T>::atomic
(1) | ||
atomic() noexcept = default; |
(C++11 起) (C++20 前) |
|
constexpr atomic() noexcept(std::is_nothrow_default_constructible_v<T>); |
(C++20 起) | |
constexpr atomic( T desired ) noexcept; |
(2) | (C++11 起) |
atomic( const atomic& ) = delete; |
(3) | (C++11 起) |
构造新的原子对象:
(C++20 前) | |
(C++20 起) |
2) 以
desired
初始化底层值。该初始化非原子。3) 原子对象非可复制构造 (CopyConstructible) 。
参数
desired | - | 用以初始化的值 |
注解
默认初始化的 std::atomic<T> 不含 |
(C++20 前) |