cpp/memory/weak ptr/atomic2

The partial template specialization of std for allows users to manipulate weak_ptr objects atomically.

If multiple threads of execution access the same std object without synchronization and any of those accesses uses a non-const member function of weak_ptr then a data race will occur unless all such access is performed through an instance of.

Associated increments are guaranteed to be part of the atomic operation. Associated decrements are sequenced after the atomic operation, but are not required to be part of it, except for the  change when overriding  in a failed CAS. Any associated deletion and deallocation are sequenced after the atomic update step and are not part of the atomic operation.

Note that the control block used by std and std is thread-safe: different non-atomic std objects can be accessed using mutable operations, such as or, simultaneously by multiple threads, even when these instances are copies or otherwise share the same control block internally.

The type may be an incomplete type.

Member functions
All non-specialized std functions are also provided by this specialization, and no additional member functions.

Member constants
The only standard std member constant is also provided by this specialization.