Added the conversion to unspecfied_bool to all smart pointers, added T& operator* to wxObjectDataPtr

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51118 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2008-01-08 22:02:12 +00:00
parent b3a029f0bb
commit a60b0ddc20
7 changed files with 128 additions and 63 deletions

View File

@@ -55,6 +55,14 @@ public:
delete m_ptr;
}
// test for pointer validity: defining conversion to unspecified_bool_type
// and not more obvious bool to avoid implicit conversions to integer types
typedef T *(wxScopedPtr<T>::*unspecified_bool_type)() const;
operator unspecified_bool_type() const
{
return m_ptr ? &wxScopedPtr<T>::get : NULL;
}
void reset(T * ptr = NULL)
{
if (m_ptr != ptr)