Skip to content

Commit 5bbbaf8

Browse files
burblebeetkoeppe
authored andcommitted
LWG3879 erase_if for flat_{,multi}set is incorrectly specified
1 parent aaf544e commit 5bbbaf8

File tree

1 file changed

+46
-14
lines changed

1 file changed

+46
-14
lines changed

source/containers.tex

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17016,15 +17016,31 @@
1701617016
\end{itemdecl}
1701717017

1701817018
\begin{itemdescr}
17019+
\pnum
17020+
\expects
17021+
\tcode{Key} meets the \oldconcept{MoveAssignable} requirements.
17022+
1701917023
\pnum
1702017024
\effects
17021-
Equivalent to:
17022-
\begin{codeblock}
17023-
auto [erase_first, erase_last] = ranges::remove_if(c, pred);
17024-
auto n = erase_last - erase_first;
17025-
c.erase(erase_first, erase_last);
17026-
return n;
17027-
\end{codeblock}
17025+
Let $E$ be \tcode{bool(pred(as_const(e)))}.
17026+
Erases all elements \tcode{e} in \tcode{c} for which $E$ holds.
17027+
17028+
\pnum
17029+
\returns
17030+
The number of elements erased.
17031+
17032+
\pnum
17033+
\complexity
17034+
Exactly \tcode{c.size()} applications of the predicate.
17035+
17036+
\pnum
17037+
\remarks
17038+
Stable\iref{algorithm.stable}.
17039+
If an invocation of \tcode{erase_if} exits via an exception,
17040+
\tcode{c} is in a valid but unspecified state\iref{defns.valid}.
17041+
\begin{note}
17042+
\tcode{c} still meets its invariants, but can be empty.
17043+
\end{note}
1702817044
\end{itemdescr}
1702917045

1703017046
\rSec2[flat.multiset]{Class template \tcode{flat_multiset}}
@@ -17612,15 +17628,31 @@
1761217628
\end{itemdecl}
1761317629

1761417630
\begin{itemdescr}
17631+
\pnum
17632+
\expects
17633+
\tcode{Key} meets the \oldconcept{MoveAssignable} requirements.
17634+
1761517635
\pnum
1761617636
\effects
17617-
Equivalent to:
17618-
\begin{codeblock}
17619-
auto [erase_first, erase_last] = ranges::remove_if(c, pred);
17620-
auto n = erase_last - erase_first;
17621-
c.erase(erase_first, erase_last);
17622-
return n;
17623-
\end{codeblock}
17637+
Let $E$ be \tcode{bool(pred(as_const(e)))}.
17638+
Erases all elements \tcode{e} in \tcode{c} for which $E$ holds.
17639+
17640+
\pnum
17641+
\returns
17642+
The number of elements erased.
17643+
17644+
\pnum
17645+
\complexity
17646+
Exactly \tcode{c.size()} applications of the predicate.
17647+
17648+
\pnum
17649+
\remarks
17650+
Stable\iref{algorithm.stable}.
17651+
If an invocation of \tcode{erase_if} exits via an exception,
17652+
\tcode{c} is in a valid but unspecified state\iref{defns.valid}.
17653+
\begin{note}
17654+
\tcode{c} still meets its invariants, but can be empty.
17655+
\end{note}
1762417656
\end{itemdescr}
1762517657

1762617658
\rSec2[container.adaptors.format]{Container adaptors formatting}

0 commit comments

Comments
 (0)