I am creating a template class in C++, and am using std::list
in it. For some reason, my compiler doesn't like how I'm trying to declare and construct an iterator for the list.
In my HashTable.h file I have:
template <typename T> class HashTable {
bool find(T thing) {
// some code
list<T>::iterator iter;
for (iter = table[index].begin(); iter != table[index].end(); ++iter) {
// some more code
}
}
}
And it gives me HashTable.h:77: error: expected ';' before "iter"
as an error message.
What's the proper syntax for the iterator?
Or is that right, and I need to create an iterator class for each of the classes I intend to use in my HashTable template? If so, that would suck...