As you saw in the last example, you can create a 2D vector using default values with nested curly brackets.
vector<vector<int> > nums {{1, 2, 3},
{5, 6, 7}};
While this option may work for small grids, an automated process is critical for creating larger grids.
Creating 2D Vectors with Loops
Unlike a traditional array, the structure of a vector is not fully developed when it is declared. Declaring a 2D vector does not provide a place to update values that have not been pushed back into the vector structure.