手写pair
  • 板块学术版
  • 楼主tin_ingot
  • 当前回复3
  • 已保存回复3
  • 发布时间2022/4/4 21:10
  • 上次更新2023/10/28 04:35:39
查看原帖
手写pair
553188
tin_ingot楼主2022/4/4 21:10

不知道为什么运行就报错,说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;
}
2022/4/4 21:10
加载中...