When I try to use the set iterator in debug mode in C ++, I get the error "map / set iterator not dereferencable". I do not understand, because I thought you should use an iterator. The code is as follows:
set<int>::iterator myIterator;
for(myIterator = mySet.begin();
myIterator != mySet.end();
myIterator++)
DoSomething(*myIterator)
This is the format of all the examples I've seen on the Internet about how to use iterators. What am I doing wrong?
source
share