么有区别,看例子,话说为啥我会觉得别扭
#include<iostream>
using namespace std;
#include<stack>
int shishi(stack<int>& a)
{
cout << "size :" << a.size() << endl;
return 0;
}
template <typename T>
int anothershi(stack<T>& a)
{
cout << "size :" << a.size() << endl;
return 0;
}
int main()
{
stack<int> b;
b.push(4);
b.push(4);
b.push(4);
b.push(4);
shishi(b);
anothershi(b);
return 0;
}
输出:
size :4
size :4