fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. struct A
  5. {
  6. A() { std::cout << "A created \n"; }
  7. A(int b) { std::cout << "A created via int \n"; }
  8. A(const A &a) { std::cout << "A copy constructed \n"; }
  9. A(A &&a) { std::cout << "A move constructed\n"; }
  10. A& operator=(const A& a) {std::cout << "A copied \n";}
  11. A& operator=(A&& a) {std::cout << "A moved \n";}
  12. };
  13.  
  14. const std::vector<A> a(2);
  15.  
  16. int main() {};
Success #stdin #stdout 0s 3016KB
stdin
Standard input is empty
stdout
A created 
A copy constructed 
A copy constructed