Consistent 'bool' conversions; scoped_ptr(auto_ptr); get_pointer(scoped_ptr) added.

[SVN r14496]
This commit is contained in:
Peter Dimov
2002-07-17 15:15:39 +00:00
parent af6fe18c9d
commit 547888d507
4 changed files with 80 additions and 15 deletions

View File

@ -92,6 +92,20 @@ public:
return px;
}
// implicit conversion to "bool"
typedef T * (this_type::*unspecified_bool_type)() const;
operator unspecified_bool_type() const // never throws
{
return px == 0? 0: &this_type::get;
}
bool operator! () const // never throws
{
return px == 0;
}
bool unique() const // never throws
{
return pn.unique();