Syntax:
#include <string> void reserve( size_type size = 0 );
The reserve() function sets the capacity of the string to at least size.
If the argument size
is less than the current number of characters (i.e. size < this→size()
), it is a nonbinding shrink-to-fit request.
reserve() runs in linear time.