Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

7
  • 1
    Please explain the downvote. Understanding the behavior of constructs used in STL makes a valid question. Commented Sep 6, 2018 at 15:07
  • 1
    It seems to me like the question you are actually asking is why std::sort sorts in the opposite order of std::priority_queue and has nothing to do with std::greater. Edit : This is not an explanation for the downvote, I didn't downvote. Commented Sep 6, 2018 at 15:08
  • 3
    Still a fairly good question : mcve + clear + specific + well formatted. Commented Sep 6, 2018 at 15:08
  • @FrançoisAndrieux: The title gives the clarity of my question. Plus clean code example is provided so as to leave no scope for ambiguity. All we need is just some patience to read the whole question. Commented Sep 6, 2018 at 15:11
  • 1
    Greater just says if something is greater than another. It doesn’t imply any specific behaviors associated with the result. You could use it to sort in either direction. Commented Sep 6, 2018 at 18:27