map iterator

Started by
1 comment, last by SiCrane 18 years, 3 months ago
iter do not support +? map<int,int>::iterator iter; iter++;//work iter+5;//fail
Advertisement
No, it does not. Read the documentation.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
If you really need that functionality you can try using std::advance(). However, std::map provides bidirectional iterators, so std::advance() manually calls operator++ the necessary number of times.

This topic is closed to new replies.

Advertisement