P
puzzlecracker
Say I have a vector<int> intVec, and I reserve some sapce
intVec.reserve(100);
Is it fair to assume the vector contains enough space for 100
elements. In which case, the capacity -- ability to store 100 elements
without a relocation -- is 100.
Then what is the difference for intVec.resize(100)?
Just trying to understand the difference between these two beasts,
size and capacity.
Thank you.
intVec.reserve(100);
Is it fair to assume the vector contains enough space for 100
elements. In which case, the capacity -- ability to store 100 elements
without a relocation -- is 100.
Then what is the difference for intVec.resize(100)?
Just trying to understand the difference between these two beasts,
size and capacity.
Thank you.