+ 1
How can it return b
b is of type U but return type of the function is T template <class T, class U> T smaller(T a, U b) { return (a < b ? a : b); }
3 Antworten
+ 2
I understand now
It will return T type only
First it will convert b into T type and return it
+ 7
You may need a refresher on templates.
http://www.cplusplus.com/doc/oldtutorial/templates/
0
What? Post your code please