4 ms·
Rc's drop will be called. But whether the exposed object's drop will be called is dependent on the reference count. But Rc would not work if the drop was not g
by zaphar 8y ago
Rc's drop will be called. But whether the exposed object's drop will be called is dependent on the reference count.
But Rc would not work if the drop was not guaranteed to be called.
- steveklabnik 8y agoIf you have a reference cycle, the two Rcs will keep each other alive, and their Drops will not be called.
- dbaupp 8y agoI was a little unclear but that is of course what I meant: talking about the underlying shared data because the pointers themselves don't have particularly interesting destruction behaviour. (Although the sibling is also correct that not all Rc/Arc/shared_ptr handles to the shared data with have their Drop called.)