Hi,
I've had a look at the QPointer header class and don't see any overloaded delete function?
This is now my class :
template<class T> class DAPointer {
T* m_pPtr;
public:
inline DAPointer( T* p=0 ) : m_pPtr(p){}
inline ~DAPointer() { delete m_pPtr; m_pPtr = NULL; }
inline void operator delete (void *p)
{ DAPointer<T>* pc = static_cast<DAPointer<T>*>(p); free(p); p = NULL; };
};
template<class T> class DAPointer {
T* m_pPtr;
public:
inline DAPointer( T* p=0 ) : m_pPtr(p){}
inline ~DAPointer() { delete m_pPtr; m_pPtr = NULL; }
inline void operator delete (void *p)
{ DAPointer<T>* pc = static_cast<DAPointer<T>*>(p); free(p); p = NULL; };
};
To copy to clipboard, switch view to plain text mode
So I thought now that the following would call the delete function above :
m_pView = new CanView();
delete m_pView;
m_pView = new CanView();
delete m_pView;
To copy to clipboard, switch view to plain text mode
As m_pView is DAPointer<CanView>m_pCanView
Unfortunately, doesn't appear my delete function is being used as getting the usual cannot convertfrom DAPointer<T> to void* error...
Anybody see anything incorrect?
Regards,
Steve
Bookmarks