std::atomic<std::shared_ptr>

Header: <memory>

The partial template specialization of std::atomic for std::shared_ptr allows users to manipulate shared_ptr objects atomically.

# Declarations

template< class T >
struct std::atomic<std::shared_ptr<T>>;

(since C++20)

# Notes

Feature-test macro Value Std Feature __cpp_lib_atomic_shared_ptr 201711L (C++20) std::atomicstd::shared_ptr

# Example

This section is incompleteReason: no example

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
LWG 3661C++20atomic<shared_ptr> was not constant-initializable from nullptrmade constant-initializable
LWG 3893C++20LWG3661 made atomic<shared_ptr> not assignable from nullptr_tassignability restored

# See also