Skip to content

Commit 8862c9e

Browse files
AlisdairMtkoeppe
authored andcommitted
P2870R3 Remove deprecated basic_string::reserve() with no parameters
1 parent 58c6c79 commit 8862c9e

File tree

3 files changed

+15
-33
lines changed

3 files changed

+15
-33
lines changed

source/compatibility.tex

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,18 @@
129129
// OK in \CppXXVI{}
130130
\end{codeblock}
131131

132+
\nodiffref
133+
\change
134+
Remove the \tcode{basic_string::reserve()} overload with no parameters.
135+
\rationale
136+
The overload of \tcode{reserve} with no parameters is redundant.
137+
The \tcode{shrink_to_fit} member function can be used instead.
138+
\effect
139+
A valid \CppXXIII{} program that calls \tcode{reserve()}
140+
on a \tcode{basic_string} object may fail to compile.
141+
The old functionality can be achieved by calling \tcode{shrink_to_fit()} instead,
142+
or the function call can be safely eliminated with no side effects.
143+
132144
\rSec2[diff.cpp23.containers]{\ref{containers}: containers library}
133145

134146
\diffref{span.overview}

source/future.tex

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,39 +1995,6 @@
19951995
The weak form may fail spuriously. See~\ref{atomics.types.operations}.
19961996
\end{itemdescr}
19971997

1998-
\rSec1[depr.string.capacity]{Deprecated \tcode{basic_string} capacity}
1999-
2000-
\pnum
2001-
The following member is declared in addition to those members specified
2002-
in \ref{string.capacity}:
2003-
2004-
\indexlibraryglobal{basic_string}%
2005-
\begin{codeblock}
2006-
namespace std {
2007-
template<class charT, class traits = char_traits<charT>,
2008-
class Allocator = allocator<charT>>
2009-
class basic_string {
2010-
public:
2011-
void reserve();
2012-
};
2013-
}
2014-
\end{codeblock}
2015-
2016-
\indexlibrarymember{reserve}{basic_string}%
2017-
\begin{itemdecl}
2018-
void reserve();
2019-
\end{itemdecl}
2020-
2021-
\begin{itemdescr}
2022-
\pnum
2023-
\effects
2024-
After this call, \tcode{capacity()} has an unspecified value
2025-
greater than or equal to \tcode{size()}.
2026-
\begin{note}
2027-
This is a non-binding shrink to fit request.
2028-
\end{note}
2029-
\end{itemdescr}
2030-
20311998
\rSec1[depr.format]{Deprecated formatting}
20321999

20332000
\rSec2[depr.format.syn]{Header \tcode{<format>} synopsis}

source/xrefdelta.tex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
% P2874R2 Mandating Annex D
2929
\removedxref{depr.res.on.required}
3030

31+
% P2870R3 Remove `basic_string::reserve()` with no parameters
32+
\removedxref{depr.string.capacity}
33+
3134
%%% Renamed sections.
3235
%%% Examples:
3336
%

0 commit comments

Comments
 (0)