Question about shared_prt doc's

In the documentation for the shared_ptr constructor that takes a weak_ptr parameter, it says that if the weak_ptr is empty then so is the constructed shared_ptr. But it also says that if the weak_ptr has a use_count() of 0 then a bad_weak_ptr exception is thrown. Since an empty weak_ptr has a use_count() of 0, these statements can't both be true. Which one is? Joe Gottman

Joe Gottman wrote:
In the documentation for the shared_ptr constructor that takes a weak_ptr parameter, it says that if the weak_ptr is empty then so is the constructed shared_ptr. But it also says that if the weak_ptr has a use_count() of 0 then a bad_weak_ptr exception is thrown. Since an empty weak_ptr has a use_count() of 0, these statements can't both be true. Which one is?
The latter. Thank you for reviewing the documentation and pointing these out!

"Peter Dimov" <pdimov@mmltd.net> wrote in message news:00b101c58f17$023fc2c0$6501a8c0@pdimov2...
Joe Gottman wrote:
In the documentation for the shared_ptr constructor that takes a weak_ptr parameter, it says that if the weak_ptr is empty then so is the constructed shared_ptr. But it also says that if the weak_ptr has a use_count() of 0 then a bad_weak_ptr exception is thrown. Since an empty weak_ptr has a use_count() of 0, these statements can't both be true. Which one is?
The latter. Thank you for reviewing the documentation and pointing these out!
Your welcome. I just saw another minor documentation bug. In the documentation for use_count() it says it returns an unspecified nonnegative value when *this is empty. This should be changed to say it returns 0 when *this is empty. Also, the documentation on "unique()" says "If you are using unique() to implement copy on write, do not rely on a specific value when the stored pointer is zero". Does this still apply? Joe Gottman
participants (2)
-
Joe Gottman
-
Peter Dimov