【发布时间】:2010-01-08 02:40:48
【问题描述】:
在整个string 的循环中,我如何查看迭代器的下一个值?
for (string::iterator it = inp.begin(); it!= inp.end(); ++it)
{
// Just peek at the next value of it, without actually incrementing the iterator
}
这在C语言中很简单,
for (i = 0; i < strlen(str); ++i) {
if (str[i] == str[i+1]) {
// Processing
}
}
在c++中有什么有效的方法吗?
注意:我没有使用 Boost。
【问题讨论】: