Ex:
template<typename T>
int compare(const T &v1, const T &v2) //當會重覆使用函式 且型別不同時
{
if( v1 < v2 ) return -1;
if( v2 < v1 ) return 1;
return 0;
}
文章標籤
全站熱搜
Ex:
template<typename T>
int compare(const T &v1, const T &v2) //當會重覆使用函式 且型別不同時
{
if( v1 < v2 ) return -1;
if( v2 < v1 ) return 1;
return 0;
}