How to initialize and allocate size for 2D vector member variable using a member function at run-time?
Is there something wrong with this approach?
class A {
vector<vector<int>> m_matrix;
// trying to resize without using explicit resize
// using the constructor of 2D vectors at run time
// want the code to look simpler and avoid new/pointers
void initialize_matrix(int row, int column) {
m_matrix = std::move(vector<vector<int>>(row, vector<int>(column, DEFAULT_VALUE)));
}
}