fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void f(int&& f)
  5. {
  6. std::cout << "r-value reference: " << f << '\n';
  7. }
  8.  
  9. void f(const int& f)
  10. {
  11. std::cout << "value: " << f << '\n';
  12. }
  13.  
  14. int main()
  15. {
  16. f(1);
  17.  
  18. int a = 2;
  19.  
  20. f(a);
  21. f(std::move(a));
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
r-value reference: 1
value: 2
r-value reference: 2