qswl不能用友元
查看原帖
qswl不能用友元
724966
YiBoRrui6楼主2023/1/15 16:08

rt 求助神犇 在写伪pair时

AC code:

struct Node
{
	int w, pos;
	bool operator < (const Node &x)const
	{
		return w > x.w;
	}
};

16pts code:

struct Node
{
	int w, pos;
	friend bool operator < (const Node &x, const Node &y) //友元是写在里面的... 
	{
		return y.w > x.w;
	}
};

???求助

2023/1/15 16:08
加载中...