fork download
  1. #include <iostream>
  2. #include <type_traits>
  3.  
  4. template<typename T>
  5. void f();
  6.  
  7. template<>
  8. void f<int>() {
  9. std::cout << "int\n";
  10. }
  11. template<>
  12. void f<unsigned>() {
  13. std::cout << "unsigned\n";
  14. }
  15. template<>
  16. void f<long>() {
  17. std::cout << "long\n";
  18. }
  19.  
  20. int main() {
  21. f<int>();
  22. f<unsigned>();
  23. f<long>();
  24. f<std::common_type<int, unsigned>::type>();
  25. }
  26.  
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
int
unsigned
long
unsigned