title: C++/Size of a 2d vector
body: <p>How do I find the size of a 2 dimensional vector? So far I have the following code which doesn't compile.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  using namespace std;
  
  int main()
  {
  
      vector &lt; vector &lt;int&gt; &gt; v2d;
  
      for (int x = 0; x &lt; 3; x++)
      {
          for (int y = 0; y &lt; 5; y++)
          {
              v2d.push_back(vector &lt;int&gt; ());
              v2d[x].push_back(y);
          }
      }
  
      cout&lt;&lt;v2d[0].size()&lt;&lt;endl;
      cout&lt;&lt;v2d[0][0].size()&lt;&lt;endl;
  
      return 0;
  }
  </code></pre>