fork(1) download
  1. #include <iostream>
  2.  
  3. // if you comment back in the code below you will see that the const int&&
  4. // overload is preferred over int&& over const int&. when called with an rvalue
  5.  
  6. void f(const int& i)
  7. {
  8. std::cout << "const & : " << i;
  9. }
  10.  
  11. /*
  12. void f(int&& i)
  13. {
  14. std::cout << " && : " << i;
  15. }
  16.  
  17. void f(const int&& i)
  18. {
  19. std::cout << "const && : " << i;
  20. }
  21. */
  22. int main()
  23. {
  24. f(3);
  25. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
const & : 3