title: std heap sorting using custom > comparator
body: <p>I'm trying to sort an integer array using std heap.</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;algorithm&gt;
  #include &lt;iostream&gt;
  
  using namespace std;
  
  struct compare {
      bool operator() (const int&amp; s1, const int&amp; s2) const{
          if (s1 &lt; s2) return true;
          return false;
      }
  };
  
  int main() {
      vector&lt;int&gt; v;
      v.push_back(8);
      v.push_back(1);
      v.push_back(3);
      v.push_back(2);
      v.push_back(4);
      make_heap(v.begin(), v.end(), compare());
      for (int i=0; i&lt;5; i++) {
          int t = v.front();
          pop_heap(v.begin(), v.end()); v.pop_back();
          cout &lt;&lt; t &lt;&lt; ' ';
      }
      cout &lt;&lt; endl;
  }
  </code></pre>
  
  <p>Now this sort outputs  8, 4, 3, 2, 1, which is correct.</p>
  
  <p>But if I change s1 &lt; s2 to s1 > s2 in the comparator function, the result becomes  1, 4, 8, 3, 2.</p>
  
  <p>What am I doing wrong here?</p>