fork download
  1. #include <iostream>
  2. #include <list>
  3. using namespace std;
  4. //3,2,1
  5. int main() {
  6. list<int> a;
  7. a.insert(a.begin(),1);
  8. cout << *(a.begin()) << endl;
  9. a.insert(a.begin(),3);
  10. cout << *a.begin()<< endl;
  11. a.insert(a.begin()++,2);
  12. list<int>::iterator iterator = a.begin();
  13. cout << *iterator << endl;
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
1
3
2