Hello,

I have a vector member and want to reallocate memory. Say I have 10 elements in a vector "vec" and I don't need them any more, so they can be erased or whatever. In the next stage I need memory just for 5 elements. In order to reallocate the vector:

1) Should I call to vec.~vector<T>() and then declare again vector<double> vec(5) ?

2) Should I use vec.resize(5)? In this case what does happen with the other 5 elements that were before? are they still allocated in memory or were they deallocated?

3) Should I use vec.reserve(5)? In this case what does happen with the other 5 elements that were before? are they still allocated in memory or were they deallocated?

4) any other suggestion

Thanks in advance.

Alejandro