Boost logo

Boost :

From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2004-09-27 09:38:32


Ben Hutchings wrote:
[...]
> If atomic_read
> returns 0 that means the use count has dropped to 0 [*] and can never
> increase again, so it must be the latest version. Otherwise weak_ptr
> makes a second test that is properly protected. So it can never use
> an old value.
>
> [*] I think this is right but I'm not certain that it can't return a
> 0 that the processor read during creation of an object that
> uses enable_shared_from_this.

What makes you uncertain?

>
> Having said all that, I feel the naming of functions may give a false
> sense of generality and encapsulation when they actually only work in
> the way they are being used currently.

You mean that

  bool expired() {
    return lock();
  }

is better?

regards,
alexander.


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