#include <vector>
std::vector<std::vector<int>> vec2d = {
{1, 2, 3},
{4, 5, 6},
{7, 8, 9}
};
#include <vector>
int rows = 3;
int cols = 3;
std::vector<std::vector<int>> vec2d;
vec2d.resize(rows, std::vector<int>(cols, 0));
#include <vector>
int rows = 3;
int cols = 3;
std::vector<std::vector<int>> vec2d(rows, std::vector<int>(cols));
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
vec2d[i][j] = i * cols + j + 1;
}
}