title: Using max_heap and min_heap interchangeably
body: <p><code>std::priority_queue</code> in C++ is by default <code>max_heap</code>. A <code>min_heap</code> in C++ is a <code>priority_queue</code> having its Compare overridden to <code>std::greater</code>.</p>
  
  <p>I want to have a function do extract element from one queue to push it to another. Depending on some condition, it might be from the <code>min_heap</code> to <code>max_heap</code> or the other way round. Because it is a generic operation, I write a function taking:</p>
  
  <pre><code>void some_operation(priority_queue&lt;T&gt;&amp; give, priority_queue&lt;T&gt;&amp; take)
  </code></pre>
  
  <p>However, because max_heap and min_heap were instantiated with different Compare, their class types are different and my plan wouldn't work. </p>
  
  <p>Is there any good/elegant solution to this?</p>
  
  <p>(I suppose this problem is more general in template classes, where the types are instantiated slightly different but the essence is mostly the same?)</p>