Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-07-11 16:46:28


From: "bill_kempf" <williamkempf_at_[hidden]>
>
> 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;

      return shared_ptr<T>(*this); // same as above

> }

Yes, I can, and I did - initially. Darin objected that such an operator->
would be confusing for weak_ptr users and people that read the code (too
much hidden meaning in p->f(),) and it's better to be explicit.


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