function
<atomic>

std::atomic_load

template (1)
template <class T> T atomic_load (const volatile atomic<T>* obj) noexcept;template <class T> T atomic_load (const atomic<T>* obj) noexcept;
overloads (2)
T atomic_load (const volatile A* obj) noexcept;T atomic_load (const A* obj) noexcept;
Read contained value
Returns the value contained in obj.

This operation is atomic and uses sequential consistency (memory_order_seq_cst). To access the value with a different memory ordering, see atomic_load_explicit.

See atomic::load and atomic::operator T for equivalent member functions of atomic.

Parameters

obj
Pointer to an atomic object.
Type A represents other overloaded atomic types (if the library does not implement the C-style atomic types as instantiations of atomic).

Return value

The contained value.
T is the type of the contained value (atomic's template parameter).

Data races

No data races (atomic operation). The operation uses sequential consistency (memory_order_seq_cst).

Exception safety

No-throw guarantee: never throws exceptions.

See also