4 ms·
I don't. I didn't know this feature existed, so I implemented my own shared pointer type with this capability in order to share sub-objects without having to d
by SamReidHughes 11y ago
I don't. I didn't know this feature existed, so I implemented my own shared pointer type with this capability in order to share sub-objects without having to define certain types with refcounts on all the sub-objects. Actually, the reason was, I didn't even have the capability to define refcounts on the sub-objects, because it was for some protocol buffers value.
Obviously, you would only want to use this feature when you have a reason to want to use it.
std::shared_ptr has no problems with confusion about who owns what, unless you start making cycles. Ownership is shared.