title: easy way to maintain a min heap with stl?
body: <p>for user defined struct, as I understand, it's easy. Just overload the operator &lt;. However, for int/float etc.., do I really need to overload operator &lt; for int?
  Here is what I tried:</p>
  
  <pre><code>       #include &lt;iostream&gt;
         #include &lt;algorithm&gt;
         #include &lt;vector&gt;
         using namespace std;
  
         bool comp(const int&amp; a, const int&amp; b)
         {
            return a&lt;b?false:true;
         }
  
         int main () 
         {
           int myints[] = {10,20,30,5,15};
           vector&lt;int&gt; v(myints,myints+5);
           vector&lt;int&gt;::iterator it;
           make_heap(v.begin(), v.end(), comp);
           cout &lt;&lt; "initial min heap   : " &lt;&lt; v.front() &lt;&lt; endl;
           for (unsigned i=0; i&lt;v.size(); i++) cout &lt;&lt; " " &lt;&lt; v[i];
           cout&lt;&lt;endl;
  
           pop_heap (v.begin(),v.end());
           v.pop_back();
           for (unsigned i=0; i&lt;v.size(); i++) cout &lt;&lt; " " &lt;&lt; v[i];
           cout&lt;&lt;endl;
         }
  </code></pre>
  
  <p>the results are:</p>
  
  <pre><code>        initial min heap   : 5
          5 10 30 20 15
          30 10 15 20
  </code></pre>
  
  <p>now pop_heap, push_heap won't maintain the min-heap correctly? is there any easier way to achieve this?
  Thanks!</p>
  
  <p>Edit: 
  sorry, I didn't check the manual carefully. yes, passing comp to pop_heap or push_heap should do the trick. However, what do you mean, I should not use an external comparator? If it's not the right way, what's the common way to achieve this?</p>