Scroll to navigation

std::atomic_ref::exchange(3) C++ Standard Libary std::atomic_ref::exchange(3)

NAME

std::atomic_ref::exchange - std::atomic_ref::exchange

Synopsis


T exchange( T desired, std::memory_order order = (since C++20)
std::memory_order_seq_cst ) const noexcept;


Atomically replaces the value of the referenced object with desired. The operation
is a read-modify-write operation. Memory is affected according to the value of
order.

Parameters


desired - value to assign
order - memory order constraints to enforce

Return value


The value of the referenced object before the call.

2024.06.10 http://cppreference.com