Documentation Home >> Headers >> <atomic> Header >> std::atomic_address class

The std::atomic_address class provides an atomic data type for pointer types, with a comprehensive set of operations.

Instances of std::atomic_address are not CopyConstructible or CopyAssignable, as these operations cannot be performed as a single atomic operation.

typedef struct atomic_address
{
    atomic_address() = default;
    constexpr atomic_address(void*);
    bool operator=(void*) volatile;

    atomic_address(const atomic_address&) = delete;
    atomic_address& operator=(
        const atomic_address&) = delete;

    bool is_lock_free() const volatile;
    void store(
        void*,memory_order = memory_order_seq_cst)
        volatile;
    void* load(
        memory_order = memory_order_seq_cst)
        const volatile;
    void* exchange(
        void*,memory_order = memory_order_seq_cst)
        volatile;

    bool compare_exchange_strong(
        void* & old_value, void* new_value,
        memory_order order = memory_order_seq_cst)
        volatile;
    bool compare_exchange_strong(
        void* & old_value, void* new_value,
        memory_order success_order,
        memory_order failure_order) volatile;
    bool compare_exchange_weak(
        void* & old_value, void* new_value,
        memory_order order = memory_order_seq_cst)
        volatile;
    bool compare_exchange_weak(
        void* & old_value, void* new_value,
        memory_order success_order,
        memory_order failure_order) volatile;

    operator void*() const volatile;

    void* fetch_add(
        ptrdiff_t,
        memory_order = memory_order_seq_cst) volatile;
    void* fetch_sub(
        ptrdiff_t,
        memory_order = memory_order_seq_cst) volatile;

    void* operator+=(ptrdiff_t) volatile;
    void* operator-=(ptrdiff_t) volatile;

} atomic_address;

bool atomic_is_lock_free(
    volatile const atomic_address*);
void atomic_init(
    volatile atomic_address*, void*);
void* atomic_exchange(
    volatile atomic_address*, void*);
void* atomic_exchange_explicit(
    volatile atomic_address*, void*, memory_order);
void atomic_store(
    volatile atomic_address*, void*);
void atomic_store_explicit(
    volatile atomic_address*, void*, memory_order);
void* atomic_load(
    volatile const atomic_address*);
void* atomic_load_explicit(
    volatile const atomic_address*, memory_order);
bool atomic_compare_exchange_strong(
    volatile atomic_address*,void* * old_value,
    void* new_value);
bool atomic_compare_exchange_strong_explicit(
    volatile atomic_address*,void* * old_value,
    void* new_value, memory_order success_order,
    memory_order failure_order);
bool atomic_compare_exchange_weak(
    volatile atomic_address*,void* * old_value,
    void* new_value);
bool atomic_compare_exchange_weak_explicit(
    volatile atomic_address*,void* * old_value,
    void* new_value, memory_order success_order,
    memory_order failure_order);

void* atomic_fetch_add(
    volatile atomic_address*, ptrdiff_t);
void* atomic_fetch_add_explicit(
    volatile atomic_address*, ptrdiff_t, memory_order);
void* atomic_fetch_sub(
    volatile atomic_address*, ptrdiff_t);
void* atomic_fetch_sub_explicit(
    volatile atomic_address*, ptrdiff_t, memory_order);
Header

#include <atomic>

See Also