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:
@@ -457,6 +457,20 @@ public:
|
||||
|
||||
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);
|
||||
|
Reference in New Issue
Block a user