Kelvin Moss wrote:
[snip]
> Perhaps I was not clear in my question. I meant to know that why does
> the greatest element get picked with the less <> function object?
> Won't it have been more intuitive to return the least element with
> less<> function object? Or may be I am missing something?
Intuitively, a priority queue is supposed to retrieve elements starting from
highest down to lowest priority. On the other hand, the standard uses
std::less<> by default to define the order relation on a type. Therefore,
the priority queue uses std::less<> to figure out the element with the top
priority.
Best
Kai-Uwe Bux