title: Vector erase function not working c++
body: <p>I'm having strange trouble with the vector erase function. All I want to do is erase the first element of a vector. </p>
  
  <p>So here are the particulars: I have created an object pointer called cv. Within this object pointer's class, there is an integer vector called v. It has a list of numbers.</p>
  
  <p>This object pointer is meant to replicate the affect of a conveyor belt. One of the things I want to do is move the belt forward. This means, in terms of the vector, deleting the number at the top position.</p>
  
  <p>To do this, I wrote <code>v.erase(v.begin())</code> in the method responsible for moving the belt forward. But when I ran this, it did not work. I got into an infinite loop where I was constantly looking at the same item.</p>
  
  <p>I then tried <code>v.erase(0)</code> but this still did not work. I tried deleting from ranges, but even that wouldn't work. The strange thing is, I'm able to add to the vector without issue, as well as look up items within it. I'm just unable to delete. Any help is appreciated. Please let me know if you need more information from me.</p>
  
  <p>Here is some relevant code:</p>
  
  <pre><code>class Belt()
  {
  vector&lt;int&gt; v;
  public:
  void MoveBelt();
  };
  
  void Belt::MoveBelt()
  {
      v.erase(v.begin());
  }
  
  int main()
  { 
      char filename[256];
      Belt *cc = new Belt(filename);
  
      if(condition met)
      {
         cc-&gt;MoveBelt();
      }
  }
  </code></pre>
  
  <p>For sake of expediency, I've not included the constructor where I read in the data from the file, nor the method where I add the items to the vector. Please take a look and let me know if you need anything else.</p>