All pastes #467569 Raw Edit

jleedev

public cpp v1 · immutable
·published 2007-05-02 16:25 UTC
rendered paste body
#include <list>#include <iostream>using namespace std;int main() {	list<int> l;	for (int i=0; i<10; i++) {		l.push_back(i);	}	list<int>::iterator it;	for (it=l.begin(); it!=l.end();) {		cout << *it << endl;		if (*it%2 == 0) {			l.erase(it++);		} else {			it++;		}	}	cout << endl;	for (it=l.begin(); it!=l.end(); it++) {		cout << *it << endl;	}}