for(i = 0; i < 5; ++i) iterator++;
?Iterators <-> Offsets
Can I set an iterator to position 5 in a string via some member
You can use std::advance
std::advance(iterator, 5);
or
iterator += 5;
Given an Iterator, how can I convert that to a numeric offset in the string?
You can use std::distance
std::distance(string.begin(), iterator);
or
iterator - string.begin()