如果 T 是整数类型 (1) | T operator+= (T val) volatile noexcept;T operator+= (T val) noexcept;T operator-= (T val) volatile noexcept;T operator-= (T val) noexcept;T operator&= (T val) volatile noexcept;T operator&= (T val) noexcept;T operator|= (T val) volatile noexcept;T operator|= (T val) noexcept;T operator^= (T val) volatile noexcept;T operator^= (T val) noexcept; |
---|---|
如果 T 是指针类型 (2) | T operator+= (ptrdiff_t val) volatile noexcept;T operator+= (ptrdiff_t val) noexcept;T operator-= (ptrdiff_t val) volatile noexcept;T operator-= (ptrdiff_t val) noexcept; |
运算符 | 成员函数 | 支持用于 | |||
---|---|---|---|---|---|
复合赋值 | 等效 | 整数类型 | 指针类型 | 其他类型 | |
+ | atomic::operator+= | atomic::fetch_add | 是 | 是 | 否 |
- | atomic::operator-= | atomic::fetch_sub | 是 | 是 | 否 |
& | atomic::operator&= | atomic::fetch_and | 是 | 否 | 否 |
| | atomic::operator|= | atomic::fetch_or | 是 | 否 | 否 |
^ | atomic::operator^= | atomic::fetch_xor | 是 | 否 | 否 |