[#absl-StringResizeAndOverwrite] = xref:absl.adoc[absl]::StringResizeAndOverwrite :relfileprefix: ../ :mrdocs: Resizes `str` to contain at most `n` characters, using the user‐provided operation `op` to modify the possibly indeterminate contents. `op` must return the finalized length of `str`. == Synopsis Declared in `<absl/strings/resize_and_overwrite.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename Op> void StringResizeAndOverwrite( T& str, T::size_type n, Op op); ---- == Description Invalidates all iterators, pointers, and references into `str`, regardless of whether reallocation occurs. `op(value_type* buf, size_t buf_size)` is allowed to write `value_type{}` to `buf[buf_size]`, which facilitiates interoperation with functions that write a trailing NUL. Please note that this requirement is more strict than `basic_string::resize_and_overwrite()`, which allows writing an abitrary value to `buf[buf_size]`. == Parameters [cols="1,4"] |=== | Name| Description | *str* | The string to resize and overwrite. | *n* | The maximum number of characters `str` will contain. | *op* | The operation used to modify the contents of `str`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#