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;
}

>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.

Comments
Absolutely! namespaces should be constrained to the smallest reasonable scope, not broadcast for everyone to see.
This article has been dead for over six months. Start a new discussion instead.