今晚用模板函数实现了插入排序算法
template<typename T>
void InsertSort(vector<T> & vecT)
{
typename vector<T>::iterator it1, it2, it1Tmp;
it1 = vecT.begin() + 1;
while(it1 != vecT.begin())
{
T key = *it1;
it1Tmp = it1;
it2 = it1 - 1;
while(it2 >= vecT.begin() && key < *it2)
{
*it1Tmp = *it1;
it1--;
it2--;
}
*it1Tmp = key;
}
}