title: C++ - Vector iterator not incrementable error
body: <p>I have myVector with some values of the type <em>Texture_Map</em> which is just an <code>int</code>.</p>
  
  <p>I'm not erasing anything... I just want to insert a value in each even iteration.</p>
  
  <p>Something like:
  If I have this vector <code>[1,2,3,4,5]</code></p>
  
  <p>And my <code>Texture_Map::TEXTURE_FLIP</code> is <code>99</code>, then my final vector should be: </p>
  
  <pre><code>[99,1,99,2,99,3,99,4,99,5]
  </code></pre>
  
  <p>After the first <code>insert()</code> I get the "<strong>Vector iterator not incrementable problem</strong>" error.</p>
  
  <p>The code:</p>
  
  <pre><code>myVector.push_back(Texture_Map::TEXTURE_INIT);
  
  for(unsigned int i = 0 ; i &lt; m_max_pieces-2; i++)
      myVector.push_back((Texture_Map::TextureID)i);
  
  std::random_shuffle(myVector.begin(), myVector.end());
  
  std::vector&lt;Texture_Map::TextureID&gt;::iterator it = myVector.begin();
  
  for (it=myVector.begin(); it&lt;myVector.end(); it++)
  {
      myVector.insert(it,Texture_Map::TEXTURE_FLIP);
  }
  </code></pre>
  
  <p>Thanks!</p>