title: Range-base for and insert on a vector C++11
body: <p>Is it possible to change the size of a vector in C++11 while iterating over it? Clearly the iterator will be invalidated, but can the following clean syntax still be used?</p>
  
  <pre><code>std::vector&lt;some_type&gt; vec;
  for(auto elem : vec) {
     if(condition(elem)) {
        new_elem = function(elem);
        vec.insert(iterator_associated_with_elem+1, new_elem);
     }
     //Don't insert on condition(new_elem)
  }
  </code></pre>
  
  <p>If not, what is the cleanest code to accomplish this task?</p>