Priority Queue Comparison

后端 未结 6 1764
心在旅途
心在旅途 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:14

    you have to specify function type and instantiate the function in priority_queue constructor.

    #include 
    
    bool compare(int a, int b)
    {
       return (a,
                                  std::function> pq(compare);
    

提交回复
热议问题