M
Markus Pitha
Hello again,
I have another question about the handling of multidimensional vectors.
Actually, it's not difficult when the size is known at the beginning,
but I still wasn't able to create dynamic vectors without knowing the size.
I want to create a vector which contains a vector of ints:
vector<vector<int> > values;
I tried to add the value 35 to the first position of the first vector
and this vector should be on the first position of the "main" vector.
How can I push_back() a vector which contains ints to a vector?
I tried it in a different way like:
vector<int> xAxis;
vector<xAxis> yAxis;
But I get compiling errors. I thought about using resize() but both
vectors will be resized in a loop so I have to resize them over and over
again. Moreover I didn't find a conclusion with resize() either. Why do
I actually have to resize them although vectors are dynamic types?
And how can I solve this issue?
Markus
I have another question about the handling of multidimensional vectors.
Actually, it's not difficult when the size is known at the beginning,
but I still wasn't able to create dynamic vectors without knowing the size.
I want to create a vector which contains a vector of ints:
vector<vector<int> > values;
I tried to add the value 35 to the first position of the first vector
and this vector should be on the first position of the "main" vector.
How can I push_back() a vector which contains ints to a vector?
I tried it in a different way like:
vector<int> xAxis;
vector<xAxis> yAxis;
But I get compiling errors. I thought about using resize() but both
vectors will be resized in a loop so I have to resize them over and over
again. Moreover I didn't find a conclusion with resize() either. Why do
I actually have to resize them although vectors are dynamic types?
And how can I solve this issue?
Markus