X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cc6ceca789f584cf3fc3fc17f6da4b7493ca69bd..6470ffba4547f8db5faa316553049d09f0c4e0b4:/include/wx/weakref.h diff --git a/include/wx/weakref.h b/include/wx/weakref.h index 99621fca49..73dcf5cdca 100644 --- a/include/wx/weakref.h +++ b/include/wx/weakref.h @@ -59,7 +59,7 @@ protected: } } - void AssignCopy( const wxWeakRefStatic& wr ) + void AssignCopy(const wxWeakRefStatic& wr) { Assign( wr.m_pobj ); } @@ -139,7 +139,7 @@ protected: void AssignCopy(const wxWeakRefImpl& wr) { - DoAssign( wr.m_pobj, wr.m_ptbase ); + DoAssign(wr.m_pobj, wr.m_ptbase); } void DoAssign( T* pobj, wxTrackable *ptbase ) { @@ -207,27 +207,20 @@ public: return *this; } - virtual ~wxWeakRef() { Release(); } + virtual ~wxWeakRef() { this->Release(); } // Smart pointer functions - T& operator*() const { return *m_pobj; } - T* operator->() const { return m_pobj; } + T& operator*() const { return *this->m_pobj; } + T* operator->() const { return this->m_pobj; } - T* get() const { return m_pobj; } - - // test for pointer validity: defining conversion to unspecified_bool_type - // and not more obvious bool to avoid implicit conversions to integer types - typedef T *(wxWeakRef::*unspecified_bool_type)() const; - operator unspecified_bool_type() const - { - return this->m_pobj ? &wxWeakRef::get : NULL; - } + T* get() const { return this->m_pobj; } + operator T*() const { return get(); } }; // Weak ref implementation assign objects are queried for wxTrackable // using dynamic_cast<> -template +template class wxWeakRefDynamic : public wxTrackerNode { public: @@ -300,11 +293,6 @@ protected: } } - void AssignCopy(const wxWeakRefDynamic& wr) - { - Assign(wr.m_pobj); - } - virtual void OnObjectDestroy() { wxASSERT_MSG( m_pobj, "tracked object should have removed us itself" );