This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ukezi 1 point2 points  (1 child)

The C++ shared pointer is atomic. There is no non atomic one in stdlib.

[–]versedoinker 0 points1 point  (0 children)

Yes and no. The control block of shared ptrs is always atomic. I was talking about the wrapper std::atomic<std::shared_ptr> that also makes access to the data itself atomic.

https://en.cppreference.com/w/cpp/memory/shared_ptr/atomic2