fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <iostream>
  4.  
  5. class Test
  6. {
  7. public:
  8.  
  9. int a;
  10. Test( int x )
  11. {
  12. std::cout << "Test(" << x << ")\n";
  13. }
  14.  
  15. Test(Test&&)
  16. {
  17. std::cout << "Test(Test&&)\n";
  18. }
  19. };
  20.  
  21. void func( Test &&test )
  22. {
  23. std::cout << "we have && " << test.a << "\n";
  24. }
  25.  
  26. void func( const Test &test )
  27. {
  28. std::cout << "we have " << test.a << "\n";
  29. }
  30.  
  31. int main()
  32. {
  33. func( Test( 20 ) );
  34. return 0;
  35. }
  36.  
Success #stdin #stdout 0s 4376KB
stdin
Standard input is empty
stdout
Test(20)
we have && 32767