In a loop running over the entire string
how do i peek at the next value of iterator?
for (string::iterator it = inp.begin(); it!= inp.end(); ++it)
{
// Just peek at the next value of it, without actually incrementing the iterator
}
This is quite simple in C,
for (i = 0; i < strlen(str); ++i) {
if (str[i] == str[i+1]) {
// Processing
}
}
Any efficient way to do above in c++?
Note: Im not using Boost.