Sorry if this is explicitly answered somewhere, but I\'m a little confused by the boost documentation and articles I\'ve read online.
I see that I can use the reset() fu
The documentation is fairly clear:
shared_ptr & operator=(shared_ptr const & r); // never throws
Effects: Equivalent to
shared_ptr(r).swap(*this)
.
So it just swaps ownership with the temporary object you create. The temporary then expires, decreasing the reference count. (And deallocating if zero.)
The purpose of these containers is to not leak memory. So no, you don't need to worry about leaking things unless you're trying to mess things up on purpose. (In other words, you probably don't need to doubt Boost knows what they're doing.)