mardi 23 mars 2021

How does greater

I came across this code

priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> minh;

Can anyone explain what greater<pair<int, int>> work in priority queue specify ? Suppose I have these pairs

(1,2)
(2,1)
(1,3)

Is my assumption correct that first the keys are compared and incase the keys are the same then the values are compared in a set ?

Aucun commentaire:

Enregistrer un commentaire