for(;itor!=m.end();itor++){}这样是提交不了的,必须写成类似这样的代码for(itor;itor!=m.end();itor++){}
template<typename T>
void swapNum(T &a,T &b)
{
T temp = a;
a = b;
b = temp;
}
int main(void)
{
int x = 10;
int y = 20;
// 调用模板函数
swapNum<int>(x,y);
cout << "x = " << x << endl;
cout << "y = " << y << endl;
return 0;
}
void swapNum(T &a,T &b)
{
T temp = a;
a = b;
b = temp;
}
int main(void)
{
int x = 10;
int y = 20;
// 调用模板函数
swapNum<int>(x,y);
cout << "x = " << x << endl;
cout << "y = " << y << endl;
return 0;
}