I have a class that takes an entry object, which consists of a word and a vector of lines in a file where this word is found. It then inserts this isnto a vector of lists of entry objects. In other words, if there already is an instance of the key within the list and it's specified index(based on first letter of the word), then it will simply add the value to the lines vector. But if there isn't an instance of said word, it will take the newly decalred newEntry and insert it into the list in alphabetical order. I seem to have encountered an issue where my list size is always 0, no matter what file I have inputted into main. I know it's a problem with this area and not with my stringstream or fstream because I have also tried manually inserting entries into my list. Does anybody have any ideas of what it might be?
If index.at(n) is empty, the for loop is skipped and we go to line 19. If index.at(n) is empty, then begin() returns the same iterator that end() does and said iterator cannot be legally dereferenced, so lines 20 and 21 result in undefined behavior.