Add weak_from_this.

This commit is contained in:
Peter Dimov
2015-01-25 20:10:57 +02:00
parent 3fd53ced83
commit 7104e7dc7e
6 changed files with 178 additions and 28 deletions
@@ -58,6 +58,16 @@ public:
return p;
}
weak_ptr<T> weak_from_this() BOOST_NOEXCEPT
{
return weak_this_;
}
weak_ptr<T const> weak_from_this() const BOOST_NOEXCEPT
{
return weak_this_;
}
public: // actually private, but avoids compiler template friendship issues
// Note: invoked automatically by shared_ptr; do not call