Hi,
I want to make a subclass of QList for any type T.
Since I'm not very familiar with templates inheriting, I try to make a mirror copy of QList first.
This is my my_list.h header file
template <class T>
class MyList : public QList<T>
{
public:
};
template <class T>
class MyList : public QList<T>
{
public:
MyList() : QList() {}
~MyList() : ~QList() {}
};
To copy to clipboard, switch view to plain text mode
I try to use MyList as a QList in the main program, but the code cannot be compiled.
The error is :
error C2059: syntax error : '~' while compiling class template member function 'MyList<T>::~MyList(void)' with [ T = MyObject *]
see reference to class template instantiation 'MyList<T>' being compiled with [ T = MyObject *]
error C2059: syntax error : '~' while compiling class template member function 'MyList<T>::~MyList(void)' with [ T = MyObject *]
see reference to class template instantiation 'MyList<T>' being compiled with [ T = MyObject *]
To copy to clipboard, switch view to plain text mode
How should I fix the error to create a template works exactly as QList?
Thanks in advance.
Bookmarks