c++ - determine if two priority_queues are equal -


i want check if 2 std::priority_queue (lets call pq)(which has vector underlying containder) equal. have in mind somehow access underlying vector , use std::equal. interface pq provides has no way of checking equality. naive way pop each element copies (because don't want lose original pqs) of 2 pqs , check 1 one size of pq large in current (time sensitive) application not favourable.

edit

it has been declared this:

typedef std::priority_queue<std::pair<int,int>, std::vector<std::pair<int,int> >, greater_than> priority_q; 

where greater_than struct(which has function , other data) handles comparision.

what want is: suppose have

priority_q a; priority_q b; 

then fill in queues , b values.

i want check if == b (by overloading ==).


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -