I've read that a vector-of-vectors is bad given a fixed 2nd dimension, but I cannot find a clear explanation of the problems on http://www.stackoverflow.com.
Could someone give an explanation of why using 2D indexing on a single vector is preferable to using a vector-of-vectors for a fixed 2nd dimension?
Also, I'm assuming that a vector-of-vectors is the preferable data structure for a 2D array with a variable 2nd dimension? If there is any proof to the contrary I'd love to see that.
vector<vector<whatever> >are not contiguous, and setting up such a vector requires more work (e.g. multiple allocations). However, those arguments are subjective opinions, not absolute statements of fact. Which approach is better depends on how behaviour of the code is measured/profiled/etc.