11 Jul
2002
11 Jul
'02
9:41 p.m.
On Thursday, July 11, 2002, at 02:38 PM, bill_kempf wrote:
Well, you could write the weak_ptr<>::operator-> to "do the right thing":
shared_ptr<T> weak_ptr<T>::operator->() { shared_ptr<T> p = make_shared(wp); if (!p) throw "something"; return p; }
As long as you don't use the result of -> with the & operator or pass it to a function taking a reference. I think the temporary lifetime is a little to subtle to be a good solution here. -- Darin