When I try:
Code:
void Iterator<T>::nextBucket()
{
delete listIterator;
while(tableIndex<tableSize && table[tableIndex]->GetSize())
tableIndex++;
if(tableIndex<tableSize)
listIterator=new ListIterator(table[tableIndex++]->GetFirst());
else
listIterator=NULL;
}
in my .cpp file and this:
Code:
template <class T>
class Iterator
{
private:
int tableIndex;
int tableSize;
LinkedList<T>** table;
ListIterator<T>* listIterator;
void nextBucket();
public:
Iterator(LinkedList<T>** const t, const int & s): tableSize(s), table(t), tableIndex(0), listIterator(NULL)
{}
~Iterator();
bool hasNext();
const LLNode<T>* next();
};
in my .h file I get this error:
src/HashSet.cpp:8: error: ‘T’ was not declared in this scope
src/HashSet.cpp:8: error: template argument 1 is invalid
and when I omit the <T> after Iterator in the cpp file I get the error:
src/HashSet.cpp:8: error: ‘template<class T> class Iterator’ used without template parameters
What am I doing wrong?