In a C++ class called ClassA, I had previously an attribute of type double dimension array of another class called ClassB:
private: ClassB matrix[ROWS][COLS];
where ROWS and COLS where static values.
I am now modifying the application to be able to specify the two dimensions on command line. I am thinking about using a vector<vector<ClassB>>
instead. Before moving to this solution, I am wondering how such an object will be initialized by default. vector
attributes are automatically allocated, but what will happen with the nested vectors ? Should I allocate them myself ?
NOTE: I was not able to find the answer to this question, so please let me know if it's a duplicate.