fork download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. class A {
  6. public:
  7. A() { cout << "A()" << endl; }
  8. A(int i) : value(i) { cout << "A(int i)" << endl; }
  9. A(const A& ra)
  10. {
  11. cout << "A(const A)" << endl;
  12. value = ra.value;
  13. }
  14. ~A() { cout << "~A()" << endl; }
  15.  
  16. A& operator=(const A& ra)
  17. {
  18. cout << "A operator=" << endl;
  19. value = ra.value;
  20. return *this;
  21. }
  22.  
  23. private:
  24. int value;
  25. };
  26.  
  27. int main() {
  28. // your code goes here
  29. A a(42);
  30. vector<A> va;
  31. va.push_back(a);
  32. return 0;
  33. }
Success #stdin #stdout 0s 3464KB
stdin
Standard input is empty
stdout
A(int i)
A(const A)
~A()
~A()