title: how to store vector of vector by index
body: <p>Hi I have to store the below mentioned information in a vector of vectors format...</p>
  
  <pre><code> vector &lt;vector &lt;int&gt;&gt; ph;
   vector&lt;int&gt; p, q;
   p.push_back(1);
   p.push_back(2);
   p.push_back(3);
  
   q.push_back(10);
   q.push_back(20);
   q.push_back(30);
   q.push_back(40); 
  </code></pre>
  
  <p>Now instead of using:</p>
  
  <pre><code> ph.push_back(p);
   ph.push_back(q);
  </code></pre>
  
  <p>I want to use:</p>
  
  <pre><code> ph.at(0)=p
   ph.at(1)=q
  </code></pre>
  
  <p>(This is the error that I am getting when I am using this: terminate called after throwing an instance of 'std::out_of_range'
    what():  vector::_M_range_check)</p>
  
  <p>The reason why I want to store it this way is....later I want to access the elements of a particular vector identified by its index i.e. 1 or 0. </p>
  
  <p>For example I wish to access ph[0].size() i.e the size of p...identified by its index. That is, I want to perform the same operation as we are able to do in the case of simple arrays in c++ i.e. store the data in that array at a particular index and access the data from a particular index.</p>