9 Dec
2009
9 Dec
'09
2:29 p.m.
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.