Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <list>
- using namespace std;
- int main() {
- list<int> l1;
- l1.push_front(1);
- l1.push_front(2);
- l1.push_front(3);
- l1.push_back(4);
- l1.push_back(5);
- l1.pop_front();
- l1.pop_back();
- list<int>::iterator it = l1.begin();
- advance(it, 1);
- l1.erase(it);
- for(list<int>::iterator it = l1.begin(); it != l1.end(); it++) {
- cout << *it << " ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment