Feature Pattern:
template<class T> T
max(T a, T b){return (a > b)? a: b;}
using:
max<int>(a, b);
but if you allow, we can write a template as follows:
T max<class T>(T a, T b){return (a > b)? a: b;}
Thus, we can maintain the same form of declaration and use it as a regular function does. and you don’t even need to enter and enter the keyword “template”. I think the template template will be the same? So is there any other reason for the pattern to become the form we know today?
i reshaped so you don't focus on the return type:
auto max<class T>(T a, T b) -> T {return (a > b)? a: b;}
user955249
source
share