fork(1) download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. void c(vector<int>& a)
  7. {
  8. vector<int> b = a;
  9. cout << "Capacity = " << b.capacity() << endl;
  10. }
  11.  
  12.  
  13. void m(vector<int>&& a)
  14. {
  15. vector<int> b = move(a);
  16. cout << "Capacity = " << b.capacity() << endl;
  17. }
  18.  
  19.  
  20. int main()
  21. {
  22. vector<int> a;
  23. a.reserve(100);
  24. cout << "Capacity = " << a.capacity() << endl;
  25. c(a);
  26. m(move(a));
  27. }
Success #stdin #stdout 0s 4768KB
stdin
Standard input is empty
stdout
Capacity = 100
Capacity = 0
Capacity = 100