fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <utility>
  4.  
  5. struct Foo
  6. {
  7. Foo() { std::cout << "created\n"; }
  8. Foo(const Foo&) { std::cout << "copied\n"; }
  9. Foo(Foo&&) { std::cout << "moved\n"; }
  10. };
  11.  
  12. int main()
  13. {
  14. std::vector<Foo> vfoo;
  15. Foo foo;
  16. vfoo.push_back(std::move(foo));
  17. }
  18.  
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
created
moved