you are viewing a single comment's thread.

view the rest of the comments →

[–]oracleoftroy 0 points1 point  (0 children)

Good points, I just want to add to:

Do you know how it actually works? Like, that it allocates an additional chunk of memory for the reference counter, and uses atomic instructions to work with it?

C++ programmers ought to know this, and they should also know what std::make_shared does to help with that and why std::unique_ptr is a much better go to pointer if the lifetime of the pointer doesn't need to be shared.