【发布时间】:2015-10-26 20:50:16
【问题描述】:
我正在使用 c++ 标准库中的列表,我想知道如何使用迭代器获取第二个元素。我有两个迭代器,我希望迭代器 2 提前 1 个节点。
intPaint(string input){
list<char>sequence (input.begin,input.end);
int count;
list<char>::iterator ptr1= sequence.begin();
list<char>::iterator ptr2= ?// I want to get the second node
...//rest of the code isn't important it just checks the characters and moves
//the iterator
}
【问题讨论】: