结构体优先队列自定义优先度

来源:互联网 发布:淘宝主店铺旺旺怎么找 编辑:程序博客网 时间:2024/04/30 19:56
bool operator ()(int &a,int &b){          return a>b;//最小值优先      } 
bool operator ()(int &a,int &b){          return a<b;//最大值优先      } 
int x;      bool operator < (const number1 &a) const {          return x>a.x;//最小值优先      }  
int x;      bool operator < (const number2 &a) const {          return x<a.x;//最大值优先      } 
原创粉丝点击