title: How to reserve memory for vector of vector
body: <p>Assume that </p>
  
  <pre><code>vector&lt;vector&lt;shared_ptr&lt;Base&gt;&gt;&gt; vec
  vec.reserve(100)
  vec[0].reserve(20)  // Error : vector subscript out of range
  </code></pre>
  
  <p>I am trying to reserve memory for both outer vector and inner vector.
  I know that the <code>vec</code> is empty so I cannot reserve memory for the inner vector. I could only <code>resize()</code> or <code>shrink_to_fit()</code> afterward. However, using <code>resize()</code> or <code>shrink_to_fit()</code> is useless due to that is not what I wanted to do. </p>
  
  <p>The intention of reserving memory for the inner vector is trying to allocate the memory well for faster searching of inner elements afterward. I am just wondering if I do not reserve the memory, the memory that is pre-allocated is expensive and chaos.</p>
  
  <p>I would like to ask :</p>
  
  <ol>
  <li>Are there any way to reserve memory for the inner vector</li>
  <li>Does my concept of "concerning about bad allocation of memory will be caused without reserving memory for the vector" correct?</li>
  </ol>
  
  <p>Sorry for my poor english and I am using VC++ 2010.</p>