fork download
  1. #include <algorithm>
  2. #include <functional>
  3. #include <iterator>
  4. #include <iostream>
  5. #include <numeric>
  6. #include <sstream>
  7. #include <string>
  8. #include <type_traits>
  9. #include <utility>
  10. #include <vector>
  11.  
  12. template <typename T1, typename T2>
  13. auto Add(T1 x, T2 y)
  14. {
  15. return x + y;
  16. }
  17.  
  18. template <>
  19. auto Add<char, char>(char x, char y)
  20. {
  21. return std::string("") + x + y;
  22. }
  23.  
  24. int main()
  25. {
  26. using namespace std;
  27. cout << Add('x', 'y') << endl;
  28. auto v = Add('x', 1);
  29. cout << v << endl;
  30. auto r = Add("hello "s, 'c');
  31. cout << r << endl;
  32. return EXIT_SUCCESS;
  33. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
xy
121
hello c