11 Jul
2002
11 Jul
'02
8:21 p.m.
From: "Mark Storer"
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 }