Requests that the string capacity be adapted to a planned change in size to a length of up to n characters (utf code units).
If n is greater than the current string capacity, the function causes the container to increase its capacity to n characters (or greater).
In all other cases, it do nothing.
This function has no effect on the string length and cannot alter its content.
BasicString!char str = "123"; assert(str.capacity == BasicString!char.minimalCapacity); const size_t cap = (str.capacity * 2); str.reserve(cap); assert(str.capacity > BasicString!char.minimalCapacity); assert(str.capacity >= cap);
See Implementation
Requests that the string capacity be adapted to a planned change in size to a length of up to n characters (utf code units).
If n is greater than the current string capacity, the function causes the container to increase its capacity to n characters (or greater).
In all other cases, it do nothing.
This function has no effect on the string length and cannot alter its content.