#include #include using namespace std; /* This one may well work with some compilers/OS, and crash with others. Who said the STL was safe ?? */ int main() { vector v; v.push_back(1); v.push_back(2); v.push_back(3); v.push_back(4); for (vector::iterator i = v.begin(); i != v.end(); i++) { cout << *i << endl; if (*i == 1) { v.push_back(5); } } }