Why does the C++ standard include an atomic_store
or atomic_load
overload for shared_ptr
, but not weak_ptr
?
Is this just an oversight, or is there an actual reason for not providing atomic operations for weak_ptr
?
This seems to be an oversight. There is a C++(17?) standard design proposal by Herb Sutter for atomic_shared_ptr/atomic_unique_ptr/atomic_weak_ptr, the document also explains the drawbacks of the existing approach with free funcitons atomic_load/atomic_store for shared_ptr: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4162.pdf