$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
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.