cpp/memory/shared ptr/atomic2

The partial template specialization of std for allows users to manipulate  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 shared_ptr then a data race will occur unless all such access is performed through an instance of (or, deprecated as of C++20, through the standalone functions for atomic access to std).

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 of a 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, and share the same control block internally.

The type T 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.