Right now i am trying to implement a vector class. However, i can't seem to get this to compile correctly. I can declare one in my main so I know the library exists, so what is going on here?

#ifndef _TABLE_HASH__
#define _TABLE_HASH__

#include <vector>
#include <iostream>

template <typename T>
class HashTable
{
public:
	HashTable(int s);
	bool inTable(T s);
	void addEntry(T s);
	bool retrieveEntry(T s);
	int Collisions();
private:
	int tableSize;
	int collisions;
        vector<T> hashVector;	
};

#endif

template <typename T>
HashTable<T>::HashTable(int s)
{
	tableSize = s;
}

template <typename T>
bool HashTable<T>::inTable(T s)
{
	return true;
}

template <typename T>
void HashTable<T>::addEntry(T s)
{
}

template <typename T>
bool HashTable<T>::retrieveEntry(T s)
{
   return true;
}

template <typename T>
int HashTable<T>::Collisions()
{
	return collisions;
}

Try prefixing 'vector' with std::

or you can put

using namespace std;

up above all of the code.

>using namespace std;
That has got to be the worst possible thing you can do with the std namespace in a header file.

Why? As long as you dont have any conflicting names, you get to omit std:: all over the place. Most people know which things are members of the STL, so it doesn't really introduce ambiguity. Am I missing something?

>As long as you dont have any conflicting names, you get to omit std:: all over the place.
How do you know that other users of the code don't have ambiguity between STL members and their own objects? They may be relying on the std:: namespace to maintain explicitness between STL members and their own code, and by including the entire std namespace in your header file, you're automatically forcing their code to place objects of the STL into the global namespace. That's extremely rude and inconsiderate.

commented: Absolutely! namespaces should be constrained to the smallest reasonable scope, not broadcast for everyone to see. +29
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.