]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/object.h
fixed memory leak in wxXmlResource introduced when fixing wxVector<> usage (patch...
[wxWidgets.git] / include / wx / object.h
index df40c11d43c2ee40710fc6e320adfab5c8cc603d..88297d21b859ce038158a2b50996268dfcf02a62 100644 (file)
@@ -457,6 +457,20 @@ public:
 
     T *get() const { return m_ptr; }
     
 
     T *get() const { return 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 *(wxObjectDataPtr<T>::*unspecified_bool_type)() const;
+    operator unspecified_bool_type() const
+    {
+        return m_ptr ? &wxObjectDataPtr<T>::get : NULL;
+    }
+
+    T& operator*() const
+    { 
+        wxASSERT(m_ptr != NULL);    
+        return *(m_ptr);
+    }
+    
     T *operator->() const
     { 
         wxASSERT(m_ptr != NULL);    
     T *operator->() const
     { 
         wxASSERT(m_ptr != NULL);