[#bsl-basic_string-0f3-resize_and_overwrite]
= xref:bsl.adoc[bsl]::xref:bsl/basic_string-0f3.adoc[basic&lowbar;string&lt;char32&lowbar;t&gt;]::resize&lowbar;and&lowbar;overwrite
:relfileprefix: ../../
:mrdocs:

Change the length of this string to the specified `newLength`, erasing characters at the end if `newLength &lt; length()` or appending the appropriate number of characters at the end if `length() &lt; newLength`&period; Subsequently, invoke the specified `operation` passing the address of the null&hyphen;terminated buffer and the adjusted length of this string as parameters&period; Finally, change the length of this string to the value returned by the `operation`&period; Throw `length&lowbar;error` if `newLength &gt; max&lowbar;size()`&period; The behavior is undefined unless the value returned by the `operation` is less than or equal to `newLength`&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;string&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class OPERATION&gt;
void
resize&lowbar;and&lowbar;overwrite(
    xref:bsl/basic_string-0f3/size_type.adoc[size&lowbar;type] newLength,
    OPERATION operation);
----


[.small]#Created with https://www.mrdocs.com[MrDocs]#
