Priority Queue Comparison

后端 未结 6 1769
心在旅途
心在旅途 2021-02-05 08:40

I\'m trying to declare a priority queue in c++ using a custom comparison function...

So , I declare the queue as follows:

std::priority_queue

        
6条回答
  •  日久生厌
    2021-02-05 09:11

    You can use a typedef. This compiles very well:

    typedef bool (*comp)(int,int);
    bool compare(int a, int b)
    {
       return (a, comp> pq(compare);
        return 0;
    }
    

提交回复
热议问题