title: Reusing a vector in C++
body: <p>I have a vector declared as a global variable that I need to be able to reuse.  For example, I am reading multiple files of data, parsing the data to create objects that are then stored in a vector. </p>
  
  <pre><code>vector&lt;Object&gt; objVector(100);
  
  void main()
  {
   while(THERE_ARE_MORE_FILES_TO_READ)
   {
      // Pseudocode
       ReadFile();
       ParseFileIntoVector();
       ProcessObjectsInVector();
       /* Here I want to 'reset' the vector to 100 empty objects again */
  
   }
  </code></pre>
  
  <p>}</p>
  
  <p>Can I reset the vector to be "vector objVector(100)" since it was initially allocated on the stack?  If I do "objVector.clear()", it removes all 100 objects and I would have a vector with a size of 0.  I need it to be a size of 100 at the start of every loop.</p>