Originally Posted by
Adrian20XX
I called it polymorphism but it seems it's a template.
In a way you are right, since templates provide a kind of "static polymorphism".
I suggest that you provide two versions of max, like what the standard library does for its max of two values:
Code:
template<typename T>
inline const T& max(const T& a, const T& b, const T& c)
{
using std::max;
return max(a, max(b, c));
}
template<typename T, typename Compare>
inline const T& max(const T& a, const T& b, const T& c, Compare compare)
{
using std::max;
return max(a, max(b, c, compare), compare);
}