fork download
  1. #include <iostream>
  2.  
  3. template<typename T>
  4. void f(const T&) { std::cout << "const T& overload\n"; }
  5.  
  6. template<typename T>
  7. void f(T&&) { std::cout << "T&& overload\n"; }
  8.  
  9. int main()
  10. {
  11. const int x = 0;
  12.  
  13. f(x);
  14. f(std::move(x));
  15. }
  16.  
  17.  
Success #stdin #stdout 0s 2896KB
stdin
Standard input is empty
stdout
const T& overload
T&& overload