Boost logo

Boost Users :

Subject: Re: [Boost-users] how to delete references to objects from a container...
From: Igor R (boost.lists_at_[hidden])
Date: 2009-12-09 09:29:58


>  If I store the shared_ptr, I want to know how to delete this explicitly from the stl container.
>
> According to my understanding shared_ptrs cannot be 'delete'd.  So, how to achieve this...?

You can delete shared_ptr from a container, just like you delete any
element, using contaners member functions (like erase(), pop_front()
etc).
You cannot delete the *pointee* of the shared_ptr, because it might be
shared. But if there's no other copy of the shared_ptr that you delete
from your container, the pointee will be deleted as well.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net