[#bsl-basic_string-0faf-shrink_to_fit]
= xref:bsl.adoc[bsl]::xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]::shrink&lowbar;to&lowbar;fit
:relfileprefix: ../../
:mrdocs:

Request removal of unused capacity&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
shrink&lowbar;to&lowbar;fit();
----

== Description

Request the removal of unused capacity by causing reallocation&period; Note that this method has no effect if the capacity is equal to the size&period; Also note that if (and only if) reallocation occurs, all iterators, including the past the end iterator, and all references to the elements are invalidated&period;


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