When I try to use a set iterator in debug mode in C++, I get an error that says "map/set iterator not dereferencable". I don't understand because I thought dereferincing was how you are supposed to use an iterator. The code looks like this:
set<int>::iterator myIterator;
for(myIterator = mySet.begin();
myIterator != mySet.end();
myIterator++)
DoSomething(*myIterator)
That is the format of all the examples I have seen online about how to use iterators. What am I doing wrond?