fork download
  1. #include <iostream>
  2.  
  3. template <typename T>
  4. void foo(const T & lvalue)
  5. {
  6. std::cout << "lvalue" << std::endl;
  7. }
  8.  
  9. template <typename T>
  10. void foo(T&& rvalue)
  11. {
  12. std::cout << "rvalue" << std::endl;
  13. }
  14.  
  15. int main()
  16. {
  17. foo(1);
  18. int i = 2;
  19. foo(i);
  20. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
rvalue
rvalue