std::vector and contiguous memory of multidimensional arrays

The standard does require the memory of an std::vector to be contiguous. On the other hand, if you write something like: std::vector<std::vector<double> > v; the global memory (all of the v[i][j]) will not be contiguous. The usual way of creating 2D arrays is to use a single std::vector<double> v; and calculate the indexes, exactly as … Read more