Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. int f() { return 2;}
  2. double f() { return 2.7;}
  3.  
  4. #include <cstdio>
  5.  
  6. template <typename typed> typed f() { return 2.7; }
  7.  
  8. int main(void) { return !printf("%d %f", f<int>(), f<double>()); }
  9.  
  10. #include <cstdio>
  11.  
  12. template <typename typed> typed f() { return f<void>(); }
  13.  
  14. template <> int f() { return 2; }
  15. template <> double f() { return 2.7; }
  16.  
  17. int main(void) { return !printf("%d %f", f<int>(), f<double>()); }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement