fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. class A
  5. {
  6. public:
  7. A() { std::cout << "Hi!"<<std::endl;}
  8. ~A(){ std::cout << "Bye"<<std::endl;}
  9. };
  10.  
  11. int main()
  12. {
  13. std::vector<A> v;
  14. std::cout << "Adding element" << std::endl;
  15. v.push_back(A());
  16. std::cout << "Popping last element" << std::endl;
  17. v.pop_back();
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 2988KB
stdin
Standard input is empty
stdout
Adding element
Hi!
Bye
Popping last element
Bye