title: Invalid heap while pushing object into vector and then pushing vector into heap
body: <p>I'm trying here to use a <code>class Bar</code> that stores a ordered array of <code>Foo</code>, by it's member <code>var</code> as seen bellow.</p>
  
  <p>I was expecting the output of this like <code>3,4,5</code> but I get <code>5,3,4</code>.</p>
  
  <p>I'm using my own compare function (mandatory because my <code>Foo struct</code> has more data) and after pushing back to the vector, I push the vector back to the heap and re-order it.</p>
  
  <p>What am I missing here?</p>
  
  <p><strong>What I want is to push a <code>Foo</code> object into my queue, and re-order automatically.</strong></p>
  
  <pre><code>struct Foo
  {
      int var;
      //etc.
  };
  
  struct compare
  {
     bool operator()(const Foo&amp; s1, const Foo&amp; s2)
     {
         return s1.var &lt; s2.var;
     }
  };
  
  class Bar
  {
  private:
      std::vector&lt;Foo&gt; m_vector;
  public:
      Bar() 
      {
          std::make_heap(m_vector.begin(), m_vector.end(), compare());
      }
  
      ~Bar() {}
  
      void push (const Foo&amp; t)
      {
          m_vector.push_back(t);
          std::push_heap(m_vector.begin(),m_vector.end(), Comp());
      }
  
      void pop()
      {
          m_vector.pop_back();
      }
  
      void dump(void)
      {
          printf ("\n Dumping:");
          for(int i = 0; i &lt; m_vector.size() ; i++)
          {
              printf ("%d ", m_vector.at(i).var);
          }
          printf ("\n");
      }
  };
  
  int main() 
  {
      Bar myBar;
  
      myBar.dump();
  
      Foo t1;
      t1.var = 3;
  
      myBar.push(t1); 
      myBar.dump();
  
      Foo t2;
      t2.var = 4;
  
      myBar.push(t2); 
      myBar.dump();
  
      Foo t3;
      t3.var = 5;
  
      myBar.push(t3); 
      myBar.dump();
  
      return 0;
  }
  </code></pre>