Resize this string and overwrite its contents.
Declared in <bslstl_string.h>
template<class OPERATION>
void
resize_and_overwrite(
size_type newLength,
OPERATION operation);
Change the length of this string to the specified newLength, erasing characters at the end if newLength < length() or appending the appropriate number of characters at the end if length() < newLength. Subsequently, invoke the specified operation passing the address of the null-terminated buffer and the adjusted length of this string as parameters. Finally, change the length of this string to the value returned by the operation. Throw length_error if `newLength > max_size()`. The behavior is undefined unless the value returned by the operation is less than or equal to newLength.
| Name | Description |
|---|---|
| newLength | new length of this string |
| operation | callable that overwrites the resized buffer |