template <typename T>
inline const T& Max (const T& a, const T& b) 
{ 
    return a < b ? b:a; 
}; 
int main()
{
    int i = 39;
    int j = 20;
    cout << "Max(i, j): " << Max(i, j) << endl; 
 
    double f1 = 13.5; 
    double f2 = 20.7; 
    cout << "Max(f1, f2): " << Max(f1, f2) << endl; 
 
    string s1 = "Hello"; 
    string s2 = "World"; 
    cout << "Max(s1, s2): " << Max(s1, s2) << endl;
    
    return 0;
}

输出:

Start
Max(i, j): 39
Max(f1, f2): 20.7
Max(s1, s2): World
0
Finish