1auto M = 4; // num of rows
2auto N = 3; // num of cols in each row
3auto default_value = 1; // default value of all int elements
4std::vector<std::vector<int>> matrix(M, std::vector<int>(N, default_value));
1 // Create a vector containing n row and m columns
2 vector<vector<int> > vec( n , vector<int> (m, 0));
1// Initializing 2D vector "vect" with
2// values
3vector<vector<int> > vect{ { 1, 2, 3 },
4 { 4, 5, 6 },
5 { 7, 8, 9 } };