This method will work for iterators that are not random-access iterators but it can still be specialized by the implementation to be no less efficient than iter += 2
when used with random-access iterators.
More Related Contents:
- Why use iterators instead of array indices?
- What happens if you call erase() on a map element while iterating from begin to end?
- Removing item from vector while iterating?
- comparing iterators from different containers
- Why use non-member begin and end functions in C++11?
- Sorting a vector in descending order
- How are iterators and pointers related?
- What’s faster, iterating an STL vector with vector::iterator or with at()?
- What is the difference between const_iterator and non-const iterator in the C++ STL?
- What is an iterator’s default value?
- Custom Iterator in C++
- Why is “!=” used with iterators instead of “
- how portable is end iterator decrement?
- Can std::begin work with array parameters and if so, how?
- Checking if an iterator is valid
- Is std::string size() a O(1) operation?
- How does std::copy work with stream iterators
- What the heque is going on with the memory overhead of std::deque?
- Why does a push_back on an std::list change a reverse iterator initialized with rbegin?
- Can raw pointers be used instead of iterators with STL algorithms for containers with linear storage?
- How to remove constness of const_iterator?
- What happens if you increment an iterator that is equal to the end iterator of an STL container
- Are const_iterators faster?
- How to check that the passed Iterator is a random access iterator?
- Do STL iterators guarantee validity after collection was changed?
- Visual c++ “for each” portability
- what is the difference between const_iterator and iterator? [duplicate]
- Types of iterator : Output vs. Input vs. Forward vs. Random Access Iterator
- How to erase & delete pointers to objects stored in a vector?
- How can I copy one map into another using std::copy?