From fc4e23d7c1cb43cd29648dd0b8d72770e2da1176 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 10 Apr 2010 18:13:23 +0000 Subject: [PATCH] Add wxWeakRef::element_type, remove unnecessary assignment operator. Define element_type for consistency with other classes (wxSharedPtr, weak_ptr) and to allow accessing the type from the template code. Also remove the apparently unnecessary template assignment operator: assignment from an expression convertible to type T* works even without it and while assigning something implicitly convertible to T* wouldn't work now, it's for the best as we don't want to rely on such implicit conversions. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63933 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/weakref.h | 9 ++------- interface/wx/weakref.h | 5 ++++- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/wx/weakref.h b/include/wx/weakref.h index b8324d07ec..96ed48ee6f 100644 --- a/include/wx/weakref.h +++ b/include/wx/weakref.h @@ -206,6 +206,8 @@ class wxWeakRef : public #endif { public: + typedef T element_type; + // Default ctor wxWeakRef() { } @@ -224,13 +226,6 @@ public: Assign(wr.get()); } - template - wxWeakRef& operator=(TDerived* pobj) - { - this->Assign(pobj); - return *this; - } - wxWeakRef& operator=(const wxWeakRef& wr) { AssignCopy(wr); diff --git a/interface/wx/weakref.h b/interface/wx/weakref.h index 05a5503fd8..d6eb9fe4d8 100644 --- a/interface/wx/weakref.h +++ b/interface/wx/weakref.h @@ -102,6 +102,9 @@ template class wxWeakRef : public wxTrackerNode { public: + /// Type of the element stored by this reference. + typedef T element_type; + /** Constructor. The weak reference is initialized to @e pobj. */ @@ -115,7 +118,7 @@ public: /** Destructor. */ - ~wxWeakRef(); + virtual ~wxWeakRef(); /** Called when the tracked object is destroyed. Be default sets