标签: c++ shared-ptr atomic
我们有atomic access到shared_ptr但我无法看到如何以原子方式重置它们:我缺少什么?
shared_ptr
答案 0 :(得分:3)
You can just use atomic_exchange with a default constructed shared_ptr:
atomic_exchange
atomic_exchange(&ptr, {});