fork download
  1. #include <iostream>
  2.  
  3. struct SomeClass
  4. {
  5. SomeClass()
  6. : value{7}
  7. { std::cout << "default" << std::endl; }
  8.  
  9. SomeClass(const SomeClass& other)
  10. : value{other.value}
  11. { std::cout << "copy" << std::endl; }
  12.  
  13. SomeClass(SomeClass&& other)
  14. : value{std::move(other.value)}
  15. { std::cout << "move" << std::endl; }
  16.  
  17. int value;
  18. };
  19.  
  20. int main()
  21. {
  22. SomeClass a[] = {SomeClass{}, SomeClass{}, SomeClass{}};
  23.  
  24. for (const auto& i : a)
  25. std::cout << i.value << std::endl;
  26.  
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
default
default
default
7
7
7