iterate in the middle
stl containers have a .begin() and .end() func.
Lets say i want to iterate from index 5000 to 5025th, how would i do this?
I dont need to know 5025th, i just want to start at index 5000 instead of 0 and increasing it 5000 times every time i call my iterate func.
Maybe i should stick with vector and deque and use the [] feature?
For random-access containers you can use begin() + 5000 to get an iterator at that location. For containers that do not give you random-access iterators, however, you'll need to iterate from the beginning to the desired position to get such an iterator.
Quote:Original post by AcidZombie24
Lets say i want to iterate from index 5000 to 5025th, how would i do this?
Why do you think you are going to want to do this?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement