Effects: Retrieves the value in
expected. It then atomically compares the value representation of
the value referenced by
*ptr for equality
with that previously retrieved from
expected,
and if
true, replaces the value referenced by
*ptr
with that in
desired. If and only if the comparison is
true,
memory is affected according to the value of
success, and
if the comparison is
false,
memory is affected according to the value of
failure. When only one
memory_order argument is supplied,
the value of
success is
order, and
the value of
failure is
order
except that a value of
memory_order::acq_rel shall be replaced by
the value
memory_order::acquire and
a value of
memory_order::release shall be replaced by
the value
memory_order::relaxed. If and only if the comparison is
false then,
after the atomic operation,
the value in
expected is replaced by
the value read from the value referenced by
*ptr
during the atomic comparison
. If the operation returns
true,
these operations are atomic read-modify-write operations (
[intro.races])
on the value referenced by
*ptr. Otherwise, these operations are atomic load operations on that memory
.