Does std::greater
work when you have a std::pair
of int
and a class?
I am trying to create a priority queue of pairs, ordered by the first element:
std::priority_queue<std::pair<double, classA>, std::vector<std::pair<double, classA>>, std::greater<std::pair<double, classA>>> priorityQueue
But I get an error that says
no match for 'operator<'`
And it alludes to the second element of the std::pair
, which is of class type.
Is std::greater
applied to the first and second elements of the std::pair
?