cpp/atomic/atomic/compare exchange

Atomically compares the of  with that of, and if those are bitwise-equal, replaces the former with  (performs read-modify-write operation). Otherwise, loads the actual value stored in into  (performs load operation).

The memory models for the read-modify-write and load operations are and  respectively. In the (2) and (4) versions is used for both read-modify-write and load operations, except that std and std are used for the load operation if, or  respectively.

Return value
if the underlying atomic value was successfully changed, otherwise.