I'm trying to create a function that returns true or false if a key is inside a map.
My code keeps crashing at line 11 for some reason.
My private variable is vector<list<Entry > >table;
The code in class Entry is pretty much just to act like a pair. So the private variables are
1 2
string key;
int value;
My current code for the function is
1 2 3 4 5 6 7 8 9 10 11 12 13 14
bool MyMap::containsKey(const string& key){
//Find out which bucket to start searching from.
int bucket = hash(key);
//Make a list in order to search through.
list<Entry>& listToSearch = table[bucket];
list<Entry>::const_iterator iter;
iter = listToSearch.begin(); // <- Causes my program to crash.
returnfalse;
}