title: C++ - Popping the first element of a vector
body: <p>I apologize if this is a duplicate. I promise I tried to find an answer first.</p>
  
  <p>I want to make a binary heap using a vector. To do so, I have to implement a pop function, that removes the "top." In this case, it simply removed the first element.</p>
  
  <p>I tried using a move function, as such:</p>
  
  <pre><code>items[Root()] = std::move(items[cur_size--]);
  </code></pre>
  
  <p>This should swap the root with another element, which it would then reorder (which also hasn't been working).</p>
  
  <p>Instead, I tried something this:</p>
  
  <pre><code>std::vector&lt;int&gt; items;
  int root = 0;
  size_t Root() {
    return root;
  }
  
  void Pop() {
    items.erase(items.begin()+root);
    root++;
    // here I would call the reorder function
  }
  </code></pre>
  
  <p>In this way I would effectively change the root and operate as if the vector started on the n-th position, rather than at 0. </p>
  
  <p>My question is, does that make sense, or is there a better way I could be implementing this?</p>
  
  <p>edit: added vector</p>