title: Clean vector every loop iteration. What is the most memory efficient way?
body: <p>I have a question about the std::vector.</p>
  
  <p>I have a very memory intensive algorithm where I forsee that predicting vector sizes and reserving enough memory for the vectors in advance will help me a lot with reducing memory usage.</p>
  
  <p>Which of the following is better:</p>
  
  <pre><code>for ( ... ) {
    std::vector&lt;Type&gt; my_vector;
    my_vector.reserve(stuff_count);
    // Do stuff , and append stuff to my_vector.
  }
  </code></pre>
  
  <p>Or this:</p>
  
  <pre><code>std::vector my_vector;
  for ( ... ) {
    my_vector.clear();
    my_vector.reserve(stuff_count);
    // Do stuff , and append stuff to my_vector.
  }
  </code></pre>
  
  <p>Please tell me which is best, or if there is an even better way of doing stuff. </p>
  
  <p>Thank you very much in advance!</p>