Why doesn't the string capacity adjust according to the resized number (15)?
int main()
{
string str = "Hello";
cout << "Original: " << str.capacity() << endl;
str.resize(15);
cout << "New: " << str.capacity() << endl;
return 0;
}
Result:
Original: 22
New: 22
I'm new to programming, so your simple explanation will be much appreciated. Thanks!