std::basic_string::shrink_to_fit

From cppreference.com
< cpp‎ | string‎ | basic string
 
 
 
std::basic_string
 
void shrink_to_fit();
(since C++11)

Requests the removal of unused capacity.

It is a non-binding request to reduce capacity() to size(). It depends on the implementation if the request is fulfilled.

If reallocation takes place, all pointers, references, and iterators are invalidated.

Parameters

(none)

Return value

(none)

Complexity

Constant