weak_ptr::expired() added; weak_ptr documentation updated.

[SVN r13141]
This commit is contained in:
Peter Dimov
2002-03-08 16:56:16 +00:00
parent 8e604a9da9
commit c17f8c36c1
3 changed files with 232 additions and 195 deletions

View File

@@ -97,7 +97,7 @@ public:
T * get() const // never throws; unsafe in multithreaded programs!
{
return use_count() == 0? 0: px;
return pn.use_count() == 0? 0: px;
}
long use_count() const // never throws
@@ -105,6 +105,11 @@ public:
return pn.use_count();
}
bool expired() const // never throws
{
return pn.use_count() == 0;
}
void swap(this_type & other) // never throws
{
std::swap(px, other.px);