title: Allocating elements in C++ vector after declaration
body: <p>Please refer to the code and comments below:</p>
  
  <pre><code>vector&lt;int&gt; v1(10);
  cin&gt;&gt;v1[0]; // allowed
  cin&gt;&gt;v1[1]; // allowed
  
  // now I want v1 to hold 20 elements so the following is possible:
  
  cin&gt;&gt;v1[15]&gt;&gt;v[19]; // how to resize the v1 so index 10 to 19 is available.
  </code></pre>