The implementation of _Sp_counted_base
uses atomic counters:
_Atomic_word _M_use_count; // #shared
_Atomic_word _M_weak_count; // #weak + (#shared != 0)
Why are the counters atomic but the pointer not? Is atomic-count necessary? Are there any examples of its necessity?
(Because std::shared_ptr
is not thread-safe, so I consider atomic-count is not necessary.)