function
<atomic>

std::atomic_store

template (1)
template <class T> void atomic_store (volatile atomic<T>* obj, T val) noexcept;template <class T> void atomic_store (atomic<T>* obj, T val) noexcept;
overloads (2)
void atomic_store (volatile A* obj, T val) noexcept;void atomic_store (A* obj, T val) noexcept;
Modify contained value
Replaces the value contained in obj with val.

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

See atomic::store and atomic::operator= 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).
val
Value to assign to the contained object.
T is the type of the value contained in the atomic object (atomic's template parameter).

Return value

none

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