From: Jonathan Wakely Date: Tue, 14 May 2024 13:28:21 +0000 (+0100) Subject: libstdc++: Document when std::string::shrink_to_fit was added X-Git-Tag: releases/gcc-14.3.0~613 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b84070e7bdf1e3666953d008f30f2b7472d9174c;p=thirdparty%2Fgcc.git libstdc++: Document when std::string::shrink_to_fit was added This section can be misread to say that shrink_to_fit is available from GCC 3.4, but it was added later. libstdc++-v3/ChangeLog: * doc/xml/manual/strings.xml: Clarify that GCC 4.5 added std::string::shrink_to_fit. * doc/html/manual/strings.html: Regenerate. (cherry picked from commit 0a99ad5c52caa06c113b1889bbe6634812b89be5) --- diff --git a/libstdc++-v3/doc/html/manual/strings.html b/libstdc++-v3/doc/html/manual/strings.html index ceb09f97eac4..34a34dfa980c 100644 --- a/libstdc++-v3/doc/html/manual/strings.html +++ b/libstdc++-v3/doc/html/manual/strings.html @@ -269,8 +269,8 @@ stringtok(Container &container, string const &in, (see this FAQ entry) but the regular copy constructor cannot be used because libstdc++'s string is Copy-On-Write in GCC 3. -

In C++11 mode you can call - s.shrink_to_fit() to achieve the same effect as +

From GCC 4.5 in C++11 mode you + can call s.shrink_to_fit() to achieve the same effect as s.reserve(s.size()).

CString (MFC)

A common lament seen in various newsgroups deals with the Standard diff --git a/libstdc++-v3/doc/xml/manual/strings.xml b/libstdc++-v3/doc/xml/manual/strings.xml index b0dab645a2d9..4a63dd964771 100644 --- a/libstdc++-v3/doc/xml/manual/strings.xml +++ b/libstdc++-v3/doc/xml/manual/strings.xml @@ -356,8 +356,8 @@ stringtok(Container &container, string const &in, entry) but the regular copy constructor cannot be used because libstdc++'s string is Copy-On-Write in GCC 3. - In C++11 mode you can call - s.shrink_to_fit() to achieve the same effect as + From GCC 4.5 in C++11 mode you + can call s.shrink_to_fit() to achieve the same effect as s.reserve(s.size()).