How to traverse fixed number of elements in c++ list

Viewed 546

I want to traverse a list in C++ but only till fifth from last not till the end. But I see that there is no "-" operator defined so that I could use

list<>::iterator j=i-5;

I can do it using size() function somehow keeping counts etc but is there any other direct way?

5 Answers
Related