c++中sort()函数是如何用的,能不能对结构体进行排序

c++中sort()函数是怎么用的,能不能对结构体进行排序啊
如题

------解决方案--------------------
struct T
{ int x,y;
}nod[100];
bool cmp(T a,T b)//先按x从小到大排,相同,再按y从小到大

return a.x<b.x
------解决方案--------------------
(a.x==b.x&&a.y<b.y);
}
sort(nod,nod+n,cmp);//n是长度
当然,你也可以如楼上的说法重载运算符,进行排序。