fork(1) download
  1. #include <iostream>
  2.  
  3. template <typename T>
  4. class A
  5. {
  6. public:
  7. void func(T&&)//accept rvalue
  8. {
  9. std::cout<<"in rvalue\n";
  10. }
  11. void func(T&)//accept lvalue
  12. {
  13. std::cout<<"in lvalue\n";
  14. }
  15. };
  16.  
  17. int main()
  18. {
  19. A<double> a;
  20. double n = 3;
  21. a.func(n);
  22. a.func(5.);
  23. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
in lvalue
in rvalue