I have the following header file:
#include <list>
using namespace std;
template <class T>
class QuickList {
public:
// Some public things
private:
list<T> _theList;
mutable list<T>::iterator _currentPointer;
};
#include <list>
using namespace std;
template <class T>
class QuickList {
public:
// Some public things
private:
list<T> _theList;
mutable list<T>::iterator _currentPointer;
};
To copy to clipboard, switch view to plain text mode
When I try to compile, I get the following errors (line numbers changed to correspond with the code above:
In file included from quicklist.cpp:1:
quicklist.h:11: error: type `std::list<T, std::allocator<_CharT> >' is not derived from type `QuickList<T>'
quicklist.h:11: error: ISO C++ forbids declaration of `iterator' with no type
quicklist.h:11: error: expected `;' before "_currentPointer"
I need the mutable keyword if I want to keep my consts intact. However, if I remove it, I still get this single error:
In file included from quicklist.cpp:1:
quicklist.h:11: error: expected `;' before "_currentPointer"
I don't understand these errors. What am I doing wrong?
Could someone help me with this?
Thanks!
Bookmarks