title: clear and resize vector - c++
body: <p>I'm trying to make a vector, then enter a while cycle, use that vector, then, resize the vector at the end of each cycle. So I decided to make <code>my_vector.clear()</code> at the end of the cycle and a <code>my_vector.resize(newSize)</code> at the beginning of it. Here's a sample code:</p>
  
  <pre><code>typedef struct my_type{
      int numNextDom;
      bool knockedDown;
  } my_type;
  
  int main (int argc, char * const argv[]) {
      int i, testCase, totalDom, numLines, num_dom=0, num_next_dom=0, aux_map_int = 0, linesScanned = 0;
      bool firstTime=true;
  
      std::cin&gt;&gt;testCase;
      std::vector&lt;my_type&gt; my_vector;
  
      while(aux_map_int &lt; testCase){
  
          std::cin&gt;&gt;totalSize&gt;&gt;numLines;
  
          my_vector.resize(totalSize);
  
          while (linesScanned &lt; numLines) {
              std::cin&gt;&gt;num_dom&gt;&gt;num_next_dom;
  
              if(firstTime){
                  my_vector[0].numNextDom = totalSize;
                  my_vector[0].knockedDown = true;
                  firstTime=false;
              }
              my_vector[num_dom].numNextDom = num_next_dom;
              my_vector[num_dom].knockedDown = false;
  
              linesScanned++;
          }
  
          std::cout &lt;&lt; giveResult(my_vector) &lt;&lt; std::endl;
          aux_map_int++;
          my_vector.clear();
      }
  
      return 0;
  }
  </code></pre>
  
  <p>So you see, after I make <code>my_vector.clean()</code> the vector becomes os size 1, but then, when the loop is re-done, <code>my_vector</code> stays of size 1 and doesn't do the <code>my_vector.resize(totalSize)</code>.
  Am I missing anything?</p>