lundi 26 octobre 2015

How do I get the second element in a standard list

I am using a list in the c++ standard library and I want to know how can I get the 2nd element with an iterator. I have two iterators and I want iterator 2 to be 1 node ahead.

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 

Aucun commentaire:

Enregistrer un commentaire