X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5a0c7d664e3f94655a6446b656eb77d9769a32df..573bd31feb9602c32eeb5b4036f35050249dc394:/include/wx/weakref.h diff --git a/include/wx/weakref.h b/include/wx/weakref.h index 9ae506798b..6691b60d6d 100644 --- a/include/wx/weakref.h +++ b/include/wx/weakref.h @@ -74,8 +74,13 @@ protected: T *m_pobj; }; -#ifdef HAVE_PARTIAL_SPECIALIZATION +#if !defined(HAVE_PARTIAL_SPECIALIZATION) || !defined(HAVE_TEMPLATE_OVERLOAD_RESOLUTION) + #define USE_STATIC_WEAKREF +#endif + + +#ifndef USE_STATIC_WEAKREF template struct wxWeakRefImpl; @@ -169,17 +174,18 @@ protected: wxTrackable *m_ptbase; }; -#endif // HAVE_PARTIAL_SPECIALIZATION +#endif // #ifndef USE_STATIC_WEAKREF + // A weak reference to an object of type T, where T has type wxTrackable // (usually statically but if not dynamic_cast<> is tried). template class wxWeakRef : public -#ifdef HAVE_PARTIAL_SPECIALIZATION - wxWeakRefImpl::value> -#else +#ifdef USE_STATIC_WEAKREF wxWeakRefStatic +#else + wxWeakRefImpl::value> #endif { public: @@ -194,6 +200,12 @@ public: Assign(pobj); } + // We need this copy ctor, since otherwise a default compiler (binary) copy happens + wxWeakRef(const wxWeakRef& wr) + { + Assign(wr.get()); + } + template wxWeakRef& operator=(TDerived* pobj) {