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
This commit is contained in:
Vadim Zeitlin 2010-04-10 18:13:23 +00:00
parent 72a0d0fc95
commit fc4e23d7c1
2 changed files with 6 additions and 8 deletions

View File

@ -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 <class TDerived>
wxWeakRef<T>& operator=(TDerived* pobj)
{
this->Assign(pobj);
return *this;
}
wxWeakRef<T>& operator=(const wxWeakRef<T>& wr)
{
AssignCopy(wr);

View File

@ -102,6 +102,9 @@ template<typename T>
class wxWeakRef<T> : 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