title: How is vector<vector<int>> "heavier" than vector<pair<int,int>>?
body: <p>During a recent interview, I suggested using <code>vector&lt;pair&lt;int,int&gt;&gt;</code> over <code>vector&lt;vector&lt;int&gt;&gt;</code> since we only wanted to store two values for every entry in the vector.  I said something to the tune of &quot;we should use <code>vector&lt;pair&lt;int,int&gt;&gt;</code> over <code>vector&lt;vector&lt;int&gt;&gt;</code> since the latter is <em>heavier</em> than the former&quot;.</p>
  <p>After the coding session was over, they said it was a good idea to use pair over a vector and asked me to elaborate what I meant by &quot;heavier&quot; earlier.  I wasn't able to elaborate, unfortunately.  Yes, I know we can enter only two values in a pair but many more in a vector and that vector gets resized automatically when its size==capacity, etc. but how should I have answered their question - why specifically was using <code>vector&lt;pair&lt;int,int&gt;&gt;</code> <em>better</em> than <code>vector&lt;vector&lt;int&gt;&gt;</code>?  What extra things are done in the latter case?</p>