Size versus Capacity
We'll test and alter the capacity of a string.
We'll cover the following...
The number of elements a string has (str.size()
) is in general smaller than the number of elements, for which space is reserved: str.capacity()
. Therefore, if you add elements to a string, new memory may not be allocated automatically. std:max_size()
returns the maximum number of elements a ...