Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. template <typename T>
  4. inline T const& max (T const& a, T const& b)
  5. {
  6. std::cout << "template" << 'n';
  7. return a < b ? b : a;
  8. }
  9.  
  10. template <typename T>
  11. inline T const& max (T const& a, T const& b, T const& c)
  12. {
  13. return max (max(a,b), c);
  14. }
  15.  
  16. inline int const& max (int const& a, int const& b)
  17. {
  18. std::cout << "non-template" << 'n';
  19. return a <b ? b : a;
  20. }
  21.  
  22. int main()
  23. {
  24. std::cout << max(3, 5, 7) << 'n';
  25. }
  26.  
  27. template
  28. template
  29. 7
  30.  
  31. int const& max (int const& a, int const& b);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement