#include<vector>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
/*inline int max(int t1, int t2)
{
return t1 > t2 ? t1 : t2;
}
inline float max(float t1, float t2)
{
return t1 > t2 ? t1 : t2;
}
inline string max(string& t1, string& t2)
{
return t1 > t2 ? t1 : t2;
}
inline int max(const vector<int> &vec)
{
return *max_element(vec.begin(), vec.end());
}
inline float max(const vector<float> &vec)
{
return *max_element(vec.begin(), vec.end());
}
inline string max(const vector<string> &vec)
{
return *max_element(vec.begin(), vec.end());
}
inline int max(const int *parray, int size)
{
return *max_element(parray, parray + size);
}
inline float max(const float *parray, int size)
{
return *max_element(parray, parray + size);
}
inline string max(const string *parray, int size)
{
return *max_element(parray, parray + size);
}*/
template <typename elemType>
inline elemType max(elemType &t1, elemType &t2)
{
return t1 > t2 ? t1 : t2;
}
template <typename vectorType>
inline vectorType max(const vector<vectorType> &vec)
{
return *max_element(vec.begin(), vec.end());
}
template <typename arraryType>
inline arraryType max(const arraryType *parray, int size)
{
return *max_element(parray, parray + size);
}
void main()
{
string sarray[] = { "we", "are", "pride", "of", "you" };
vector<string> svec(sarray, sarray + 5);
int iarray[] = { 12, 34, 2, 54, 222 };
vector<int> ivec(iarray, iarray + 5);
float farray[] = { 12.1, 34.2, 54.1, 23.5, 3.2 };
vector<float> fvec = { farray, farray + 5 };
string smax = max(max(svec), max(sarray, 5));
int imax = max(max(ivec), max(iarray, 5));//括号也不能用中文输入法
float fmax = max(max(fvec), max(farray, 5));
cout << "smax should be were--found:" << smax << '\n';
cout << max(svec) << endl;
cout << max(sarray, 5) << endl;
cout << "imax should be were--found:" << imax << '\n';
cout << max(iarray, 5) << endl;
cout << max(ivec) << endl;
cout << "fmax should be were--found:" << fmax << '\n';
cout << max(farray, 5) << endl;
cout << max(fvec) << endl;
getchar();
}