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
.
namespace std {
template<> struct atomic_ref<integral> {
private:
integral* ptr;
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() const noexcept;
void notify_all() const noexcept;
};
}