|
Boost Users : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-07-11 15:21:28
From: "Mark Storer" <mstorer_at_[hidden]>
> So the only purpose of a weak_ptr is to be able to grab a shared_ptr from
it
> (and to avoid circular references, of course)?
Yes. The "idiomatic" use is:
weak_ptr<X> wp;
// ...
if(shared_ptr<X> p = make_shared(wp))
{
// use p
}
else
{
// target lost
}
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