I complete my problem here.
My problem is something like this:
num = 10;
for (i = 0; i < num-1; i++)
size = (i +1) * n; // where n is a random number between 1 and 10
vector<double> vec(size, 0.0);
for (j = 0 ; j < size-1; j++)
vec[j] = (j + 1) * (i + n);
// now I do something with "vec". Once I have it done I don't
// need the previously calculated "vec" anymore. I always want to use
// exactly the total capacity, so I would like to deallocate the previously
// calculated "vec" because I am going to declare again the "vec" with
// the new capacity in the next i-loop
I pressume that I should do something in order to not cause a failure when the declaration "vector<double> vec(size, 0.0) " for i = 1 comes into the picture.
so, any thought?