bool Digraph::removeVertex(const string& toRemove) {
int labelIndex = findLabel(toRemove);
if( labelIndex != -1 ) { // CASE: toRemove is in the set
for(auto it = verLabels.begin(); it != verLabels.end(); it++) { // Loop verLabels
if(*it == toRemove) { // CASE: toRemove is found
verLabels.erase(it);
nVertices--;
} // END if
} // END for
for(auto it = adjLists.begin(); it != adjLists.end(); it++) { // Loop lists
if( (*it).front() == toRemove ) { // CASE: toRemove is found
nEdges -= (*it).size();
adjLists.erase(it);
} // END if
} // END for(it)
for( int i = 0; i < adjLists.size(); i++ ) { // Loop adjLists
for( auto listIt = adjLists[i].begin(); listIt != adjLists[i].end(); listIt++ ) { // Loop list elements
if( *listIt == toRemove ) { // CASE: toRemove found
adjLists[i].erase(listIt);
nEdges--;
} // END if
} // END for(listIt)
} // END for(i)
returntrue;
} // END if
returnfalse;
} // END removeVertex(const string& toRemove)
I'm pretty certain that vector iterators are incrementable, especially after looking on the <vector> page and seeing .begin() returns a random access iterator. Am I getting the error because of my use of auto considering verLabels is type vector<string> and adjLists is vector< list<string> >?