fork download
  1. #include <iostream>
  2. #include <list>
  3. #include <algorithm>
  4. using namespace std;
  5.  
  6. struct A{
  7. A() { cout << "A()\n";}
  8. ~A() {cout << "~A()\n";}
  9. void print() { cout << "print\n";}
  10. } ;
  11.  
  12. int main() {
  13. // your code goes here
  14. list<A> a(4);
  15. cout << "0\n";
  16. auto it = a.erase(a.begin());
  17. it->print();
  18. cout << "1\n";
  19. return 0;
  20. }
Success #stdin #stdout 0s 4340KB
stdin
Standard input is empty
stdout
A()
A()
A()
A()
0
~A()
print
1
~A()
~A()
~A()