Boost logo

Boost :

From: fkoh2000 (fkoh_at_[hidden])
Date: 2002-02-09 15:59:26


--- In boost_at_y..., "Greg Colvin" <gcolvin_at_u...> wrote:
> > I just downloaded weak_ptr, and I was wondering how useful it
is. What
> > can you do with a weak_ptr<T> that you can't do with a plain T*?
>
> One common use is to keep a cache of shared objects. The cache can
> be implemented as a container of weak_ptr, so that just being in
> the cache doesn't prevent an object from being deleted when the last
> shared_ptr to the object goes away.

One I may want to use the cache is to
get a shared_ptr from it. From the
docs, I couldn't find the way to
get a shared_ptr from a weak_ptr.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk