【坑】different compare function (priority, vector,...)

priority_queue<Point, vector<Point>, pqCmp>

struct pqCmp {

  bool operator() (const Point& a, const Point& b) const {

    return distance(a,center) < distance(b, center);

  }

};

 

vector<Point> v;

sort(v.begin(), v.end(), cmp);

static bool cmp(const Point& a, const Point& b) {

  return distance(a, center) < distance(b, center);

}

 

posted @ 2017-07-27 04:04  grainy  阅读(123)  评论(0编辑  收藏  举报