Skip to content

P1464R1 Mandating the Standard Library: Clause 22 - Iterators library #2746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 38 additions & 64 deletions source/iterators.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1764,7 +1764,7 @@
\tcode{*r} &
unspecified &
&
\requires \tcode{r} is dereferenceable. \\ \rowsep
\expects \tcode{r} is dereferenceable. \\ \rowsep

\tcode{++r} &
\tcode{X\&} &
Expand Down Expand Up @@ -1830,23 +1830,23 @@
\tcode{a != b} &
contextually convertible to \tcode{bool} &
\tcode{!(a == b)} &
\requires \orange{a}{b} is in the domain of \tcode{==}. \\ \rowsep
\expects \orange{a}{b} is in the domain of \tcode{==}. \\ \rowsep

\tcode{*a} &
\tcode{reference}, convertible to \tcode{T} &
&
\requires \tcode{a} is dereferenceable.\br
\expects \tcode{a} is dereferenceable.\br
The expression\br \tcode{(void)*a, *a} is equivalent to \tcode{*a}.\br
If \tcode{a == b} and \orange{a}{b} is in the domain of \tcode{==}
then \tcode{*a} is equivalent to \tcode{*b}. \\ \rowsep
\tcode{a->m} &
&
\tcode{(*a).m} &
\requires \tcode{a} is dereferenceable. \\ \rowsep
\expects \tcode{a} is dereferenceable. \\ \rowsep
\tcode{++r} &
\tcode{X\&} &
&
\requires \tcode{r} is dereferenceable.\br
\expects \tcode{r} is dereferenceable.\br
\ensures \tcode{r} is dereferenceable or \tcode{r} is past-the-end;\br
any copies of the previous value of \tcode{r} are no longer
required to be dereferenceable nor to be in the domain of \tcode{==}. \\ \rowsep
Expand Down Expand Up @@ -1905,27 +1905,27 @@
\tcode{*r = o} &
result is not used &
&
\remarks\ After this operation \tcode{r} is not required to be dereferenceable.\br
\remarks After this operation \tcode{r} is not required to be dereferenceable.\br
\ensures \tcode{r} is incrementable. \\ \rowsep

\tcode{++r} &
\tcode{X\&} &
&
\tcode{addressof(r) == addressof(++r)}.\br
\remarks\ After this operation \tcode{r} is not required to be dereferenceable.\br
\remarks After this operation \tcode{r} is not required to be dereferenceable.\br
\ensures \tcode{r} is incrementable. \\ \rowsep

\tcode{r++} &
convertible to \tcode{const X\&} &
\tcode{\{ X tmp = r;}\br
\tcode{ ++r;}\br
\tcode{ return tmp; \}} &
\remarks\ After this operation \tcode{r} is not required to be dereferenceable.\br
\remarks After this operation \tcode{r} is not required to be dereferenceable.\br
\ensures \tcode{r} is incrementable. \\ \rowsep

\tcode{*r++ = o} &
result is not used &&
\remarks\ After this operation \tcode{r} is not required to be dereferenceable.\br
\remarks After this operation \tcode{r} is not required to be dereferenceable.\br
\ensures \tcode{r} is incrementable. \\
\end{libreqtab4b}

Expand Down Expand Up @@ -2048,7 +2048,7 @@
\tcode{\dcr r} &
\tcode{X\&} &
&
\requires there exists \tcode{s} such that \tcode{r == ++s}.\br
\expects there exists \tcode{s} such that \tcode{r == ++s}.\br
\ensures \tcode{r} is dereferenceable.\br
\tcode{\dcr(++r) == r}.\br
\tcode{\dcr r == \dcr s} implies \tcode{r == s}.\br
Expand Down Expand Up @@ -2111,7 +2111,7 @@
\tcode{r -= n} &
\tcode{X\&} &
\tcode{return r += -n;} &
\requires the absolute value of \tcode{n} is in the range of
\expects the absolute value of \tcode{n} is in the range of
representable values of \tcode{difference_type}. \\ \rowsep

\tcode{a - n} &
Expand All @@ -2122,7 +2122,7 @@
\tcode{b - a} &
\tcode{difference_type} &
\tcode{return n} &
\requires there exists a value \tcode{n} of type \tcode{difference_type} such that \tcode{a + n == b}.\br
\expects there exists a value \tcode{n} of type \tcode{difference_type} such that \tcode{a + n == b}.\br
\tcode{b == a + (b - a)}. \\ \rowsep

\tcode{a[n]} &
Expand Down Expand Up @@ -3269,7 +3269,7 @@
\begin{itemdescr}
\pnum
\constraints
The expression \tcode{x.base() == y.base()} shall be valid and
\tcode{x.base() == y.base()} is well-formed and
convertible to \tcode{bool}.

\pnum
Expand All @@ -3288,7 +3288,7 @@
\begin{itemdescr}
\pnum
\constraints
The expression \tcode{x.base() != y.base()} shall be valid and
\tcode{x.base() != y.base()} is well-formed and
convertible to \tcode{bool}.

\pnum
Expand All @@ -3307,7 +3307,7 @@
\begin{itemdescr}
\pnum
\constraints
The expression \tcode{x.base() > y.base()} shall be valid and
\tcode{x.base() > y.base()} is well-formed and
convertible to \tcode{bool}.

\pnum
Expand All @@ -3326,7 +3326,7 @@
\begin{itemdescr}
\pnum
\constraints
The expression \tcode{x.base() < y.base()} shall be valid and
\tcode{x.base() < y.base()} is well-formed and
convertible to \tcode{bool}.

\pnum
Expand All @@ -3345,7 +3345,7 @@
\begin{itemdescr}
\pnum
\constraints
The expression \tcode{x.base() >= y.base()} shall be valid and
\tcode{x.base() >= y.base()} is well-formed and
convertible to \tcode{bool}.

\pnum
Expand All @@ -3364,7 +3364,7 @@
\begin{itemdescr}
\pnum
\constraints
The expression \tcode{x.base() <= y.base()} shall be valid and
\tcode{x.base() <= y.base()} is well-formed and
convertible to \tcode{bool}.

\pnum
Expand Down Expand Up @@ -4014,12 +4014,11 @@

\begin{itemdescr}
\pnum
\effects Constructs a \tcode{move_iterator}, initializing
\tcode{current} with \tcode{u.base()}.
\mandates \tcode{U} is convertible to \tcode{Iterator}.

\pnum
\requires \tcode{U} shall be convertible to
\tcode{Iterator}.
\effects Constructs a \tcode{move_iterator}, initializing
\tcode{current} with \tcode{u.base()}.
\end{itemdescr}

\indexlibrarymember{operator=}{move_iterator}%
Expand All @@ -4029,12 +4028,11 @@

\begin{itemdescr}
\pnum
\effects Assigns \tcode{u.base()} to
\tcode{current}.
\mandates \tcode{U} is convertible to \tcode{Iterator}.

\pnum
\requires \tcode{U} shall be convertible to
\tcode{Iterator}.
\effects Assigns \tcode{u.base()} to
\tcode{current}.
\end{itemdescr}

\rSec3[move.iter.op.conv]{Conversion}
Expand Down Expand Up @@ -4206,7 +4204,7 @@
\begin{itemdescr}
\pnum
\constraints
The expression \tcode{x.base() == y.base()} shall be valid and
\tcode{x.base() == y.base()} is well-formed and
convertible to \tcode{bool}.

\pnum
Expand All @@ -4229,7 +4227,7 @@
\begin{itemdescr}
\pnum
\constraints
The expression \tcode{x.base() == y.base()} shall be valid and
\tcode{x.base() == y.base()} is well-formed and
convertible to \tcode{bool}.

\pnum
Expand All @@ -4245,7 +4243,7 @@
\begin{itemdescr}
\pnum
\constraints
The expression \tcode{x.base() < y.base()} shall be valid and
\tcode{x.base() < y.base()} is well-formed and
convertible to \tcode{bool}.

\pnum
Expand All @@ -4261,7 +4259,7 @@
\begin{itemdescr}
\pnum
\constraints
The expression \tcode{y.base() < x.base()} shall be valid and
\tcode{y.base() < x.base()} is well-formed and
convertible to \tcode{bool}.

\pnum
Expand All @@ -4277,7 +4275,7 @@
\begin{itemdescr}
\pnum
\constraints
The expression \tcode{y.base() < x.base()} shall be valid and
\tcode{y.base() < x.base()} is well-formed and
convertible to \tcode{bool}.

\pnum
Expand All @@ -4293,7 +4291,7 @@
\begin{itemdescr}
\pnum
\constraints
The expression \tcode{x.base() < y.base()} shall be valid and
\tcode{x.base() < y.base()} is well-formed and
convertible to \tcode{bool}.

\pnum
Expand Down Expand Up @@ -4331,7 +4329,7 @@
\begin{itemdescr}
\pnum
\constraints
The expression \tcode{x + n} shall be valid and have type \tcode{Iterator}.
\tcode{x + n} is well-formed and has type \tcode{Iterator}.

\pnum
\returns \tcode{x + n}.
Expand Down Expand Up @@ -5660,10 +5658,6 @@
\end{itemdecl}

\begin{itemdescr}
\pnum
\effects
Constructs a copy of \tcode{x}.

\pnum
\ensures \tcode{in_stream == x.in_stream} is \tcode{true}.

Expand Down Expand Up @@ -5745,6 +5739,9 @@
\end{itemdecl}

\begin{itemdescr}
\pnum
\expects \tcode{in_stream != nullptr} is \tcode{true}.

\pnum
\effects Equivalent to:
\begin{codeblock}
Expand Down Expand Up @@ -5870,29 +5867,6 @@
\tcode{delim} with \tcode{delimiter}.
\end{itemdescr}


\indexlibrary{\idxcode{ostream_iterator}!constructor}%
\begin{itemdecl}
ostream_iterator(const ostream_iterator& x);
\end{itemdecl}

\begin{itemdescr}
\pnum
\effects
Constructs a copy of \tcode{x}.
\end{itemdescr}

\indexlibrary{\idxcode{ostream_iterator}!destructor}%
\begin{itemdecl}
~ostream_iterator();
\end{itemdecl}

\begin{itemdescr}
\pnum
\effects
The iterator is destroyed.
\end{itemdescr}

\rSec3[ostream.iterator.ops]{Operations}

\indexlibrarymember{operator=}{ostream_iterator}%
Expand Down Expand Up @@ -6248,9 +6222,9 @@

\begin{itemdescr}
\pnum
\requires
\expects
\tcode{s.rdbuf()}
shall not be a null pointer.
is not a null pointer.

\pnum
\effects
Expand All @@ -6265,9 +6239,9 @@

\begin{itemdescr}
\pnum
\requires
\expects
\tcode{s}
shall not be a null pointer.
is not a null pointer.

\pnum
\effects
Expand Down