it depends on what you need to do really. I did a lot of matrix math, and I kept each matrix separate as its own thing, which could then easily be used in computations and so on.
that would look like
vector<Matrix> (6); // store 6 variables in 1 vector, each variable is a matrix
do you just need raw storage? I would use vector instead of a pointer, for sure.
what you have will work just fine, if it solves the problem you have.
-- its common to use struct instead of class for this type of container, as classes have private members by default and usually use the getter-setter paradigm, while structs are public by default and simple structs sometimes avoid the getter-setter nonsense for simple use cases. This is just a common convention.
I would probably wrap this thing one more time. Final thing (as you did it) would look like
1 2 3 4 5 6 7 8 9 10
|
struct All_Vars
{ type var1,var2,var3,var4;};
class Meta
{
int rows, columns; //tie the rows and cols to the group for design reasons
vector<All_Vars> All_Vars;
//assignment operator? file read/write method? other stuff maybe? constructor?
//getters, setters... etc
};
|
if you don't want the suggested methods, you can just do struct meta and leave it as a pure data blob object. Those have merits, when they solve the problem at hand.