Hashtable

Why is it giving error while trying to compile this part? I do not understand.
vector<HashEntry> array;

Here is my full code.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
template <class HashedObj>
class HashTable
{
public:
	explicit HashTable( const HashedObj & notFound, int size = 101 );
	HashTable( const HashTable & rhs )
		: ITEM_NOT_FOUND( rhs.ITEM_NOT_FOUND ),
		array( rhs.array ), currentSize( rhs.currentSize ) { }

	const HashedObj & find( const HashedObj & x ) const;

	void makeEmpty( );
	void insert( const HashedObj & x );
	void remove( const HashedObj & x );

	const HashTable & operator=( const HashTable & rhs );

	enum EntryType { ACTIVE, EMPTY, DELETED };


private:
	struct HashEntry
	{
		HashedObj element;
		EntryType info;

		HashEntry( const HashedObj & e = HashedObj( ), EntryType i = EMPTY )
			: element( e ), info( i ) { }
	};

	vector<HashEntry> array;
	int currentSize;
	const HashedObj ITEM_NOT_FOUND;

	bool isActive( int currentPos ) const;
	int findPos( const HashedObj & x ) const;
	void rehash( );
};


The errors;

* missing ';' before '<' (on line vector<HashEntry> array;)
* see reference to class template instantiation 'HashTable<HashedObj>' being compiled
* missing type specifier - int assumed. Note: C++ does not support default-int (on line vector<HashEntry> array;)
* unexpected token(s) preceding ';' (on line vector<HashEntry> array;)
It seems that you shall specify std::vector<HashEntry> or you forgot to include header <vector>
I forgot both using namespace and vector header. Thank you very much, it is solved now. I have long way to go :)
Topic archived. No new replies allowed.