Skip to content

Commit 4408f46

Browse files
jensmaurerzygoloid
authored andcommitted
[lib] Replace pre: and post: in requirements tables (#1284)
with \requires and \postcondition, respectively. Also replace yields: with \returns and effect: with \effects. Fixes #1281.
1 parent cf2241b commit 4408f46

File tree

5 files changed

+54
-52
lines changed

5 files changed

+54
-52
lines changed

source/iostreams.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1684,7 +1684,7 @@
16841684
\tcode{P p = i;} &
16851685
&
16861686
&
1687-
post: \tcode{p == P(i)}. \\ \rowsep
1687+
\postconditions \tcode{p == P(i)}. \\ \rowsep
16881688
\tcode{P(o)} &
16891689
\tcode{fpos} &
16901690
converts from \tcode{offset} & \\ \rowsep

source/iterators.tex

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@
290290
\tcode{*r} &
291291
unspecified &
292292
&
293-
pre: \tcode{r} is dereferenceable. \\ \rowsep
293+
\requires \tcode{r} is dereferenceable. \\ \rowsep
294294

295295
\tcode{++r} &
296296
\tcode{X\&} &
@@ -356,25 +356,25 @@
356356
\tcode{a != b} &
357357
contextually convertible to \tcode{bool} &
358358
\tcode{!(a == b)} &
359-
pre: \orange{a}{b} is in the domain of \tcode{==}. \\ \rowsep
359+
\requires \orange{a}{b} is in the domain of \tcode{==}. \\ \rowsep
360360

361361
\tcode{*a} &
362362
\tcode{reference}, convertible to \tcode{T} &
363363
&
364-
pre: \tcode{a} is dereferenceable.\br
364+
\requires \tcode{a} is dereferenceable.\br
365365
The expression\br \tcode{(void)*a, *a} is equivalent to \tcode{*a}.\br
366366
If \tcode{a == b} and \orange{a}{b} is in the domain of \tcode{==}
367367
then \tcode{*a} is equivalent to \tcode{*b}. \\ \rowsep
368368
\tcode{a->m} &
369369
&
370370
\tcode{(*a).m} &
371-
pre: \tcode{a} is dereferenceable. \\ \rowsep
371+
\requires \tcode{a} is dereferenceable. \\ \rowsep
372372
\tcode{++r} &
373373
\tcode{X\&} &
374374
&
375-
pre: \tcode{r} is dereferenceable.\br
376-
post: \tcode{r} is dereferenceable or \tcode{r} is past-the-end.\br
377-
post: any copies of the previous value of \tcode{r} are no longer
375+
\requires \tcode{r} is dereferenceable.\br
376+
\postconditions \tcode{r} is dereferenceable or \tcode{r} is past-the-end;\br
377+
any copies of the previous value of \tcode{r} are no longer
378378
required either to be dereferenceable or to be in the domain of \tcode{==}. \\ \rowsep
379379

380380
\tcode{(void)r++} &
@@ -432,27 +432,27 @@
432432
result is not used &
433433
&
434434
\remarks\ After this operation \tcode{r} is not required to be dereferenceable.\br
435-
post: \tcode{r} is incrementable. \\ \rowsep
435+
\postconditions \tcode{r} is incrementable. \\ \rowsep
436436

437437
\tcode{++r} &
438438
\tcode{X\&} &
439439
&
440440
\tcode{\&r == \&++r}.\br
441441
\remarks\ After this operation \tcode{r} is not required to be dereferenceable.\br
442-
post: \tcode{r} is incrementable. \\ \rowsep
442+
\postconditions \tcode{r} is incrementable. \\ \rowsep
443443

444444
\tcode{r++} &
445445
convertible to \tcode{const X\&} &
446446
\tcode{\{ X tmp = r;}\br
447447
\tcode{ ++r;}\br
448448
\tcode{ return tmp; \}} &
449449
\remarks\ After this operation \tcode{r} is not required to be dereferenceable.\br
450-
post: \tcode{r} is incrementable. \\ \rowsep
450+
\postconditions \tcode{r} is incrementable. \\ \rowsep
451451

452452
\tcode{*r++ = o} &
453453
result is not used &&
454454
\remarks\ After this operation \tcode{r} is not required to be dereferenceable.\br
455-
post: \tcode{r} is incrementable. \\
455+
\postconditions \tcode{r} is incrementable. \\
456456
\end{libreqtab4b}
457457

458458
\pnum
@@ -580,8 +580,8 @@
580580
\tcode{\dcr r} &
581581
\tcode{X\&} &
582582
&
583-
pre: there exists \tcode{s} such that \tcode{r == ++s}.\br
584-
post: \tcode{r} is dereferenceable.\br
583+
\requires there exists \tcode{s} such that \tcode{r == ++s}.\br
584+
\postconditions \tcode{r} is dereferenceable.\br
585585
\tcode{\dcr(++r) == r}.\br
586586
\tcode{\dcr r == \dcr s} implies \tcode{r == s}.\br
587587
\tcode{\&r == \&\dcr r}. \\ \hline
@@ -643,7 +643,7 @@
643643
\tcode{r -= n} &
644644
\tcode{X\&} &
645645
\tcode{return r += -n;} &
646-
pre: the absolute value of \tcode{n} is in the range of
646+
\requires the absolute value of \tcode{n} is in the range of
647647
representable values of \tcode{difference_type}. \\ \rowsep
648648

649649
\tcode{a - n} &
@@ -654,7 +654,7 @@
654654
\tcode{b - a} &
655655
\tcode{difference_type} &
656656
\tcode{return n} &
657-
pre: there exists a value \tcode{n} of type \tcode{difference_type} such that \tcode{a + n == b}.\br
657+
\requires there exists a value \tcode{n} of type \tcode{difference_type} such that \tcode{a + n == b}.\br
658658
\tcode{b == a + (b - a)}. \\ \rowsep
659659

660660
\tcode{a[n]} &

source/lib-intro.tex

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,18 +1678,18 @@
16781678
Expression & Return type & Operational semantics \\ \capsep
16791679
\tcode{P u(np);}\br &
16801680
&
1681-
post: \tcode{u == nullptr} \\
1681+
\postconditions \tcode{u == nullptr} \\
16821682
\tcode{P u = np;} &
16831683
&
16841684
\\ \rowsep
16851685

16861686
\tcode{P(np)} &
16871687
&
1688-
post: \tcode{P(np) == nullptr} \\ \rowsep
1688+
\postconditions \tcode{P(np) == nullptr} \\ \rowsep
16891689

16901690
\tcode{t = np} &
16911691
\tcode{P\&} &
1692-
post: \tcode{t == nullptr} \\ \rowsep
1692+
\postconditions \tcode{t == nullptr} \\ \rowsep
16931693

16941694
\tcode{a != b} &
16951695
contextually convertible to \tcode{bool} &
@@ -1875,11 +1875,11 @@
18751875

18761876
\tcode{p->m} &
18771877
type of \tcode{T::m} &
1878-
\textit{pre:} \tcode{(*p).m} is well-defined. equivalent to \tcode{(*p).m} & \\ \rowsep
1878+
\requires \tcode{(*p).m} is well-defined. equivalent to \tcode{(*p).m} & \\ \rowsep
18791879

18801880
\tcode{q->m} &
18811881
type of \tcode{T::m} &
1882-
\textit{pre:} \tcode{(*q).m} is well-defined. equivalent to \tcode{(*q).m} & \\ \rowsep
1882+
\requires \tcode{(*q).m} is well-defined. equivalent to \tcode{(*q).m} & \\ \rowsep
18831883

18841884
\tcode{static_-} \tcode{cast<X::pointer>(w)} &
18851885
\tcode{X::pointer} &
@@ -1904,10 +1904,10 @@
19041904

19051905
\tcode{a.deallocate(p,n)} &
19061906
(not used) &
1907-
\textit{pre:} \tcode{p} shall be a value returned by an earlier call
1907+
\requires \tcode{p} shall be a value returned by an earlier call
19081908
to \tcode{allocate} that has not been invalidated by
19091909
an intervening call to \tcode{deallocate}. \tcode{n} shall
1910-
match the value passed to \tcode{allocate} to obtain this memory.
1910+
match the value passed to \tcode{allocate} to obtain this memory.\br
19111911
\throws Nothing. & \\ \rowsep
19121912

19131913
\tcode{a.max_size()} &
@@ -1937,33 +1937,33 @@
19371937
\tcode{X u = a;} &
19381938
&
19391939
Shall not exit via an exception.\br
1940-
post: \tcode{u == a} & \\ \rowsep
1940+
\postconditions \tcode{u == a} & \\ \rowsep
19411941

19421942
\tcode{X u(b);} &
19431943
&
19441944
Shall not exit via an exception.\br
1945-
post: \tcode{Y(u) == b}, \tcode{u == X(b)} & \\ \rowsep
1945+
\postconditions \tcode{Y(u) == b}, \tcode{u == X(b)} & \\ \rowsep
19461946

19471947
\tcode{X u(std::move(a));} \br
19481948
\tcode{X u = std::move(a);} &
19491949
&
19501950
Shall not exit via an exception.\br
1951-
post: \tcode{u} is equal to the prior value of \tcode{a}. & \\ \rowsep
1951+
\postconditions \tcode{u} is equal to the prior value of \tcode{a}. & \\ \rowsep
19521952

19531953
\tcode{X u(std::move(b));} &
19541954
&
19551955
Shall not exit via an exception.\br
1956-
post: \tcode{u} is equal to the prior value of \tcode{X(b)}. & \\ \rowsep
1956+
\postconditions \tcode{u} is equal to the prior value of \tcode{X(b)}. & \\ \rowsep
19571957

19581958
\tcode{a.construct(c, args)}&
19591959
(not used) &
1960-
Effect: Constructs an object of type \tcode{C} at
1960+
\effects Constructs an object of type \tcode{C} at
19611961
\tcode{c} &
19621962
\tcode{::new ((void*)c) C(forward<\brk{}Args>\brk(args)...)} \\ \rowsep
19631963

19641964
\tcode{a.destroy(c)} &
19651965
(not used) &
1966-
Effect: Destroys the object at \tcode{c} &
1966+
\effects Destroys the object at \tcode{c} &
19671967
\tcode{c->\~{}C()} \\ \rowsep
19681968

19691969
\tcode{a.select_on_container_copy_construction()} &

source/numerics.tex

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,21 +1954,21 @@
19541954
\tcode{e.seed()}%
19551955
\indextext{\idxcode{seed}!random number engine requirement}
19561956
& \tcode{void}
1957-
& post:
1957+
& \postconditions
19581958
\tcode{e == E()}.
19591959
& same as \tcode{E()}
19601960
\\ \rowsep
19611961
\tcode{e.seed(s)}%
19621962
\indextext{\idxcode{seed}!random number engine requirement}
19631963
& \tcode{void}
1964-
& post:
1964+
& \postconditions
19651965
\tcode{e == E(s)}.
19661966
& same as \tcode{E(s)}
19671967
\\ \rowsep
19681968
\tcode{e.seed(q)}%
19691969
\indextext{\idxcode{seed}!random number engine requirement}
19701970
& \tcode{void}
1971-
& post:
1971+
& \postconditions
19721972
\tcode{e == E(q)}.
19731973
& same as \tcode{E(q)}
19741974
\\ \rowsep
@@ -2032,7 +2032,7 @@
20322032
adjacent numbers are separated
20332033
by one or more space characters.
20342034

2035-
post: The \tcode{os.}\textit{fmtflags} and fill character are unchanged.
2035+
\postconditions The \tcode{os.}\textit{fmtflags} and fill character are unchanged.
20362036
& \bigoh{$\mbox{size of state}$}
20372037
\\ \rowsep
20382038
\tcode{is >> v}%
@@ -2053,7 +2053,7 @@
20532053
provided that there have been no intervening invocations
20542054
of \tcode{x} or of \tcode{v}.
20552055

2056-
pre:
2056+
\requires
20572057
\tcode{is} provides a textual representation
20582058
that was previously written
20592059
using an output stream
@@ -2063,7 +2063,7 @@
20632063
\tcode{charT} and \tcode{traits}
20642064
were respectively the same as those of \tcode{is}.
20652065

2066-
post: The \tcode{is.}\textit{fmtflags} are unchanged.
2066+
\postconditions The \tcode{is.}\textit{fmtflags} are unchanged.
20672067
& \bigoh{$\mbox{size of state}$}
20682068
\\
20692069
\end{libreqtab4d}
@@ -2350,7 +2350,7 @@
23502350
\tcode{d.param(p)}
23512351
\indextext{\idxcode{param}!random number distribution requirement}
23522352
& \tcode{void}
2353-
& post: \tcode{d.param() == p}.
2353+
& \postconditions \tcode{d.param() == p}.
23542354
& no worse than the complexity of \tcode{D(p)}
23552355
\\ \rowsep
23562356
\tcode{d(g)}
@@ -2421,7 +2421,7 @@
24212421
& Writes to \tcode{os} a textual representation
24222422
for the parameters and the additional internal data of \tcode{x}.
24232423

2424-
post: The \tcode{os.}\textit{fmtflags} and fill character are unchanged.
2424+
\postconditions The \tcode{os.}\textit{fmtflags} and fill character are unchanged.
24252425
&
24262426
\\ \rowsep
24272427
\tcode{is >> d}
@@ -2435,14 +2435,14 @@
24352435
calls \tcode{is.setstate(ios\colcol{}failbit)}
24362436
(which may throw \tcode{ios\colcol{}failure}~[\ref{iostate.flags}]).
24372437

2438-
pre: \tcode{is} provides a textual representation
2438+
\requires \tcode{is} provides a textual representation
24392439
that was previously written
24402440
using an \tcode{os} whose imbued locale
24412441
and whose type's template specialization arguments
24422442
\tcode{charT} and \tcode{traits}
24432443
were the same as those of \tcode{is}.
24442444

2445-
post: The \tcode{is.}\textit{fmtflags} are unchanged.
2445+
\postconditions The \tcode{is.}\textit{fmtflags} are unchanged.
24462446
&
24472447
\\
24482448
\end{libreqtab4d}

source/strings.tex

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -147,48 +147,50 @@
147147
\tcode{X::state_type} & &
148148
(described in~\ref{char.traits.typedefs}) & compile-time \\ \rowsep
149149
\tcode{X::eq(c,d)} & \tcode{bool} &
150-
yields: whether \tcode{c} is to be treated as equal to \tcode{d}. & constant \\ \rowsep
150+
\returns whether \tcode{c} is to be treated as equal to \tcode{d}. & constant \\ \rowsep
151151
\tcode{X::lt(c,d)} & \tcode{bool} &
152-
yields: whether \tcode{c} is to be treated as less than \tcode{d}. & constant \\ \rowsep
152+
\returns whether \tcode{c} is to be treated as less than \tcode{d}. & constant \\ \rowsep
153153
\tcode{X::compare(p,q,n)} & \tcode{int} &
154-
yields: \tcode{0} if for each \tcode{i} in \tcode{[0,n)}, \tcode{X::eq(p[i],q[i])}
154+
\returns \tcode{0} if for each \tcode{i} in \tcode{[0,n)}, \tcode{X::eq(p[i],q[i])}
155155
is \tcode{true}; else, a negative value if, for some \tcode{j} in \tcode{[0,n)},
156156
\tcode{X::lt(p[j],q[j])} is \tcode{true} and for each \tcode{i} in \tcode{[0,j)}
157157
\tcode{X::eq(p[i],q[i])} is \tcode{true}; else a positive value. & linear \\ \rowsep
158158
\tcode{X::length(p)} & \tcode{size_t} &
159-
yields: the smallest \tcode{i} such that \tcode{X::eq(p[i],charT())} is \tcode{true}. & linear \\ \rowsep
159+
\returns the smallest \tcode{i} such that \tcode{X::eq(p[i],charT())} is \tcode{true}. & linear \\ \rowsep
160160
\tcode{X::find(p,n,c)} & \tcode{const X::char_type*} &
161-
yields: the smallest \tcode{q} in \tcode{[p,p+n)} such that
161+
\returns the smallest \tcode{q} in \tcode{[p,p+n)} such that
162162
\tcode{X::eq(*q,c)} is \tcode{true}, zero otherwise. & linear \\ \rowsep
163163
\tcode{X::move(s,p,n)} & \tcode{X::char_type*} &
164164
for each \tcode{i} in \tcode{[0,n)}, performs \tcode{X::assign(s[i],p[i])}.
165-
Copies correctly even where the ranges \tcode{[p,p+n)} and \tcode{[s,s+n)} overlap. yields: \tcode{s}. & linear \\ \rowsep
165+
Copies correctly even where the ranges \tcode{[p,p+n)} and \tcode{[s,s+n)} overlap.\br \returns \tcode{s}. & linear \\ \rowsep
166166
\tcode{X::copy(s,p,n)} & \tcode{X::char_type*} &
167-
pre: \tcode{p} not in \tcode{[s,s+n)}. yields: \tcode{s}. for each \tcode{i} in
167+
\requires \tcode{p} not in \tcode{[s,s+n)}. \returns \tcode{s}.\br
168+
for each \tcode{i} in
168169
\tcode{[0,n)}, performs \tcode{X::assign(s[i],p[i])}. & linear \\ \rowsep
169170
\tcode{X::assign(r,d)} & (not used) &
170171
assigns \tcode{r=d}. & constant \\ \rowsep
171172
\tcode{X::assign\-(s,n,c)} & \tcode{X::char_type*} &
172173
for each \tcode{i} in \tcode{[0,n)}, performs
173-
\tcode{X::assign(s[i],c)}. yields: \tcode{s}. & linear \\ \rowsep
174+
\tcode{X::assign(s[i],c)}.\br
175+
\returns \tcode{s}. & linear \\ \rowsep
174176
\tcode{X::not_eof(e)} & \tcode{int_type} &
175-
yields: \tcode{e} if \tcode{X::eq_int_type(e,X::eof())} is \tcode{false},
177+
\returns \tcode{e} if \tcode{X::eq_int_type(e,X::eof())} is \tcode{false},
176178
otherwise a value \tcode{f} such that
177179
\tcode{X::eq_int_type(f,X::eof())} is \tcode{false}. & constant \\ \rowsep
178180
\tcode{X::to_char_type\-(e)} & \tcode{X::char_type} &
179-
yields: if for some \tcode{c}, \tcode{X::eq_int_type(e,X::to_int_type(c))}
181+
\returns if for some \tcode{c}, \tcode{X::eq_int_type(e,X::to_int_type(c))}
180182
is \tcode{true}, \tcode{c}; else some unspecified value. & constant \\ \rowsep
181183
\tcode{X::to_int_type\-(c)} & \tcode{X::int_type} &
182-
yields: some value \tcode{e}, constrained by the definitions of
184+
\returns some value \tcode{e}, constrained by the definitions of
183185
\tcode{to_char_type} and \tcode{eq_int_type}. & constant \\ \rowsep
184186
\tcode{X::eq_int_type\-(e,f)} & \tcode{bool} &
185-
yields: for all \tcode{c} and \tcode{d}, \tcode{X::eq(c,d)} is equal to
187+
\returns for all \tcode{c} and \tcode{d}, \tcode{X::eq(c,d)} is equal to
186188
\tcode{X::eq_int_type(X::to_int_type(c), X::to_int_type(d))}; otherwise, yields \tcode{true}
187189
if \tcode{e} and \tcode{f} are both copies of \tcode{X::eof()}; otherwise, yields \tcode{false} if
188190
one of \tcode{e} and \tcode{f} is a copy of \tcode{X::eof()} and the other is not; otherwise
189191
the value is unspecified. & constant \\ \rowsep
190192
\tcode{X::eof()} & \tcode{X::int_type} &
191-
yields: a value \tcode{e} such that \tcode{X::eq_int_type(e,X::to_int_type(c))}
193+
\returns a value \tcode{e} such that \tcode{X::eq_int_type(e,X::to_int_type(c))}
192194
is \tcode{false} for all values \tcode{c}. & constant \\
193195
\end{libreqtab4d}
194196

0 commit comments

Comments
 (0)