In my main method, the following code has an error at the line containing the insertion.
hashTable<string, pair<string, string>> friendsHash = hashTable<string, pair<string, string>>(friendTotal);
if(critChoice == 1)
{
for(int counter = 0; counter < friendTotal; counter ++)
{
string name = friends[counter].getName();
string date = friends[counter].getBirthDate();
string homeTown = friends[counter].getHomeTown();
friendsHash.insert(pair<name, pair<date, homeTown>>);
}
}
The hashMap’s insertion function is as follows:
template<class K, class E>
void hashTable<K, E>::insert(const pair<const K, E>& thePair)
{
int b = search(thePair.first);
//check if matching element found
if(table[b] == NULL)
{
//no matching element and table not full
table[b] = new pair<const K, E> (thePair);
dSize ++;
}
else
{//check if duplicate or table full
if(table[b]->first == thePair.first)
{//duplicate, change table[b]->second
table[b]->second = thePair.second;
}
else //table is full
throw hashTableFull();
}
}
The error is that each of the 3 arguments in the insertion function call is not a valid template type argument for parameter
You are muddling the syntax for instantiating a class template to get a type, with that for instantiating a type to get an object.
should be
or if you can use C++11