cpp/string/basic string/resize and overwrite

Resizes the string to contain at most characters, using the user-provided operation  to modify the possibly indeterminate contents and set the length. This avoids the cost of initializing a suitably-sized std when it is intended to be used as a char array to be populated by, e.g., a C API call.

This function performs following steps:
 * 1) Obtains a contiguous storage that contains  characters, and makes its first  characters equal to the first  characters of, where  is the smaller of  and the result of  before the call to . Let  denote the pointer to the first character in the storage.
 * 2) * The equality is determined as if by checking.
 * 3) * The characters in may have indeterminate values.
 * 4) Evaluates . Let  be the return value of.
 * 5) Replaces the contents of  with  (which sets the length of  to ). Invalidates all pointers and references to the range.

The program is ill-formed if does not have an integer-like type. The behavior is undefined if throws an exception or modifies  or,  is not in the range , or any character in range  has an indeterminate value.

Implementations are recommended to avoid unnecessary copies and allocations by, e.g., making equal to the pointer to beginning of storage of characters allocated for  after the call, which can be identical to the existing storage of  if  is less than or equal to.

Return value
(none)

Exceptions
std if. Any exceptions thrown by corresponding.

If an exception is thrown from, the behavior is undefined. Otherwise, if an exception is thrown, this function has no effect.