There are specializations of the atomic_ref class template
for the integral types
char,
signed char,
unsigned char,
short,
unsigned short,
int,
unsigned int,
long,
unsigned long,
long long,
unsigned long long,
char8_t,
char16_t,
char32_t,
wchar_t,
and any other types needed by the typedefs in the header <cstdint> ([cstdint.syn]).

For each such type integral,
the specialization atomic_ref<integral> provides
additional atomic operations appropriate to integral types.

[ Note

: — *end note*

]namespace std { template<> struct atomic_ref<integral> { private: integral* ptr; // exposition only public: using value_type = integral; using difference_type = value_type; static constexpr size_t required_alignment = implementation-defined; static constexpr bool is_always_lock_free = implementation-defined; bool is_lock_free() const noexcept; explicit atomic_ref(integral&); atomic_ref(const atomic_ref&) noexcept; atomic_ref& operator=(const atomic_ref&) = delete; void store(integral, memory_order = memory_order_seq_cst) const noexcept; integral operator=(integral) const noexcept; integral load(memory_order = memory_order_seq_cst) const noexcept; operator integral() const noexcept; integral exchange(integral, memory_order = memory_order_seq_cst) const noexcept; bool compare_exchange_weak(integral&, integral, memory_order, memory_order) const noexcept; bool compare_exchange_strong(integral&, integral, memory_order, memory_order) const noexcept; bool compare_exchange_weak(integral&, integral, memory_order = memory_order_seq_cst) const noexcept; bool compare_exchange_strong(integral&, integral, memory_order = memory_order_seq_cst) const noexcept; integral fetch_add(integral, memory_order = memory_order_seq_cst) const noexcept; integral fetch_sub(integral, memory_order = memory_order_seq_cst) const noexcept; integral fetch_and(integral, memory_order = memory_order_seq_cst) const noexcept; integral fetch_or(integral, memory_order = memory_order_seq_cst) const noexcept; integral fetch_xor(integral, memory_order = memory_order_seq_cst) const noexcept; integral operator++(int) const noexcept; integral operator--(int) const noexcept; integral operator++() const noexcept; integral operator--() const noexcept; integral operator+=(integral) const noexcept; integral operator-=(integral) const noexcept; integral operator&=(integral) const noexcept; integral operator|=(integral) const noexcept; integral operator^=(integral) const noexcept; void wait(integral, memory_order = memory_order::seq_cst) const noexcept; void notify_one() noexcept; void notify_all() noexcept; }; }

```
integral fetch_key(integral operand, memory_order order = memory_order_seq_cst) const noexcept;
```

Effects:
Atomically replaces the value referenced by *ptr with
the result of the computation applied to the value referenced by *ptr
and the given operand.

Memory is affected according to the value of order.

These operations are atomic read-modify-write operations ([intro.races]).

Remarks:
For signed integer types,
the result is as if the object value and parameters
were converted to their corresponding unsigned types,
the computation performed on those types, and
the result converted back to the signed type.

```
integral operator op=(integral operand) const noexcept;
```