不知道为什么运行就报错,说15行在“p”之前缺少模板参数。
#include<bits/stdc++.h>
using namespace std;
template<typename T>
struct pairs
{
T first,second;
void make_pairs(T x,T y)
{
first=x;
second=y;
}
};
int main()
{
pairs p;
p.make_pairs(5,6);
cout<<p.first<<' '<<p.second;
return 0;
}