cpp/experimental/atomic weak ptr/compare exchange

Atomically compares the underlying in  with, and if they are equivalent, replaces the former with  (performs read-modify-write operation). Otherwise, loads the actual value stored in into  (performs load operation). The replacement is performed as if by the copy or move assignment operator of, as appropriate.

Two s are equivalent if and only if they store the same pointer value and share ownership.

The memory models for the read-modify-write and load operations are and  respectively. For overloads, is used for both read-modify-write and load operations, except that std and std are used for the load operation if , or  respectively.

The weak versions may fail spuriously.

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

Remarks
If the compare-exchange operation return, is not accessed after the atomic update step. If it returns, is updated with the existing value read from the  object in the attempted atomic update. The update corresponding to the write to  is part of the atomic operation, but the write to  itself is not required to be part of the atomic operation.

For overloads, is not accessed after the atomic update step.

For overloads, is moved from only if the compare-exchange operation returns ; the moving occurs after the atomic update step.