fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template<class X> struct Test {
  5. static void run (void) {
  6. cout << "default" <<endl;
  7. }
  8. };
  9. template<class Z> struct Test<Z&&> {
  10. static void run (void) {
  11. cout << "&&" << endl;
  12. }
  13. };
  14.  
  15. int main() {
  16. int dummy = 42;
  17. int moved = 21;
  18. int && rv = move (moved);
  19. int & lv = dummy;
  20.  
  21. int q = 42;
  22. int * qptr = &q;
  23. auto && wtf = &q;
  24. auto && wtf2 = qptr;
  25.  
  26. Test<decltype (rv)>:: run ();
  27. Test<decltype (lv)>:: run ();
  28. Test<decltype (wtf)>:: run();
  29. Test<decltype (wtf2)>:: run ();
  30. return 0;
  31. }
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout
&&
default
&&
default