std::atomic_ref<T>::operator=
来自 cppreference.cn
< cpp | atomic | atomic ref
value_type operator=( value_type desired ) const noexcept; |
(1) | (constexpr since C++26) |
atomic_ref& operator=( const atomic_ref& ) = delete; |
(2) | |
目录 |
[编辑] 参数
desired | - | 要赋值的值 |
[编辑] 返回值
如上所述。
[编辑] 注解
与大多数赋值运算符不同,atomic_ref
的赋值运算符不返回对其左侧参数的引用。它返回存储值的副本。
[编辑] 缺陷报告
以下行为变更的缺陷报告被追溯应用于先前发布的 C++ 标准。
DR | 应用于 | 已发布行为 | 正确行为 |
---|---|---|---|
LWG 3508 (P3323R1) |
C++20 | 赋值运算符对于 const T 无意义 | 约束为仅接受非 const T |
[编辑] 参见
构造一个 atomic_ref 对象(公开成员函数) | |
原子地将引用对象的值替换为非原子参数 (公开成员函数) |