[v3] basic_string::reserve() shrink-to-fit?

Paolo Carlini pcarlini@unitus.it
Fri Dec 12 11:49:00 GMT 2003


Jonathan Wakely wrote:

> How about a "6. Shrink-to-fit strings" entry in 21_strings/howto.html
> that documents the fact that libstdc++ does/will support shrink requests
> from 3.4, but not before, and suggesting the alternative below ?
>
> std::string(str.data(), str.size()).swap(str);

Seems to me a really nice idea!

Paolo.



More information about the Libstdc++ mailing list