For associative containers, can the ++ operator send an iterator past the end of a collection?
Example:
map<UINT32, UINT32> new_map;
new_map[0] = 0;
new_map[1] = 1;
map<UINT32, UINT32> new_iter = new_map.begin();
++new_iter;
++new_iter;
++new_iter;
++new_iter;
++new_iter;
++new_iter;
++new_iter;
At the end of this, does new_iter == new_map.end(), or does it end up in the great unknown?
Note: I know this is messed up and not the way to do things. I’m working around some WTF corporate code.
If you increment the end iterator, the result is undefined behavior. So, it could remain end, or go off the end, or email your grandmother a link to goatse.
See also: What if I increment an iterator by 2 when it points onto the last element of a vector?