X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c4021a7920ab9f41b1553e28f1177b6e39a6d901..cc3977bf132d40cb66c6b488890ef67a396d4a0a:/include/wx/weakref.h diff --git a/include/wx/weakref.h b/include/wx/weakref.h index b8324d07ec..08878903f4 100644 --- a/include/wx/weakref.h +++ b/include/wx/weakref.h @@ -149,7 +149,7 @@ protected: DoAssign( pobj, ptbase ); } -#ifdef HAVE_DYNAMIC_CAST +#ifndef wxNO_RTTI void AssignHelper(T* pobj, wxInt2Type) { // A last way to get a trackable pointer @@ -165,7 +165,7 @@ protected: Release(); } } -#endif // HAVE_DYNAMIC_CAST +#endif // RTTI enabled void AssignCopy(const wxWeakRefImpl& wr) { @@ -206,9 +206,22 @@ class wxWeakRef : public #endif { public: + typedef T element_type; + // Default ctor wxWeakRef() { } + // Enabling this ctor for VC6 results in mysterious compilation failures in + // wx/window.h when assigning wxWindow pointers (FIXME-VC6) +#ifndef __VISUALC6__ + // Ctor from the object of this type: this is needed as the template ctor + // below is not used by at least g++4 when a literal NULL is used + wxWeakRef(T *pobj) + { + Assign(pobj); + } +#endif // !__VISUALC6__ + // When we have the full type here, static_cast<> will always work // (or give a straight compiler error). template @@ -224,13 +237,6 @@ public: Assign(wr.get()); } - template - wxWeakRef& operator=(TDerived* pobj) - { - this->Assign(pobj); - return *this; - } - wxWeakRef& operator=(const wxWeakRef& wr) { AssignCopy(wr); @@ -248,7 +254,7 @@ public: }; -#ifdef HAVE_DYNAMIC_CAST +#ifndef wxNO_RTTI // Weak ref implementation assign objects are queried for wxTrackable // using dynamic_cast<> @@ -332,7 +338,7 @@ protected: T *m_pobj; }; -#endif // #ifdef HAVE_DYNAMIC_CAST +#endif // RTTI enabled // Provide some basic types of weak references