struct Cord
{
int x_cord;
int y_cord;
Cord(int x = 0,int y = 0):x_cord(x),y_cord(y) {}
bool operator < (const Cord& cord) const
{
if (x_cord == cord.x_cord)
{
return y_cord < cord.y_cord;
}
return x_cord < cord.x_cord;
}
bool operator == (const Cord& cord) const
{
return x_cord == cord.x_cord && y_cord == cord.y_cord;
}
};
std::set<Cord> cordRes,cordTmp;//initialized before
std::set<Cord> cordItersect;
std::set_intersection(cordRes.begin(),cordRes.end(),cordTmp.begin(),cordTmp.end(),cordRes.begin(),cordItersect.begin());
上述代码编译失败set_intersection
。在示例中如何正确使用任何建议?谢谢