question on assignment with boost::shared_ptr (vs. the reset() function)
问题 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() function to release the memory within a shared_ptr (assuming the reference count goes to zero), e.g., shared_ptr<int> x(new int(0)); x.reset(new int(1)); This, I believe would result in the creation of two integer objects, and by the end of these two lines the integer equaling zero would be deleted from memory. But, what if I use