advance.cpp

We use cookies. Read the Privacy and Cookie Policy

advance.cpp

#include ‹stl.h›

#include ‹iostream.h›

int main() {

 typedef vector‹int› IntVector;

 IntVector v(10);

 for (int i = 0; i ‹ v.size(); i++) v[i] = i;

 IntVector::iterator location = v.begin();

 cout ‹‹ "At Beginning: " ‹‹ *location ‹‹ endl;

 advance(location, 5);

 cout ‹‹ "At Beginning + 5: " ‹‹ *location ‹‹ endl;

 return 0;

}