
27 Sep
2004
27 Sep
'04
2:38 p.m.
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.