Skip to content

Commit fa34096

Browse files
committed
[iterator.concept.winc] Move concept definition near its description
Also rename the placeholder type I to T, used in the specification of the exposition-only concepts is-integer-like and is-signed-integer-like, to avoid a presentation conflict with the placeholder type I referring to an iterator type.
1 parent 22789a0 commit fa34096

File tree

1 file changed

+46
-44
lines changed

1 file changed

+46
-44
lines changed

source/iterators.tex

Lines changed: 46 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,20 +1306,10 @@
13061306

13071307
template<class T>
13081308
inline constexpr bool @\exposid{is-signed-integer-like}@ = @\seebelow@; @\itcorr[-2]@ // \expos
1309-
1310-
template<class I>
1311-
concept @\deflibconcept{weakly_incrementable}@ =
1312-
default_initializable<I> && @\libconcept{movable}@<I> &&
1313-
requires(I i) {
1314-
typename iter_difference_t<I>;
1315-
requires @\exposid{is-signed-integer-like}@<iter_difference_t<I>>;
1316-
{ ++i } -> @\libconcept{same_as}@<I&>; // not required to be equality-preserving
1317-
i++; // not required to be equality-preserving
1318-
};
13191309
\end{codeblock}
13201310

13211311
\pnum
1322-
A type \tcode{I} is an \defnadj{integer-class}{type}
1312+
A type \tcode{T} is an \defnadj{integer-class}{type}
13231313
if it is in a set of \impldef{integer-class type} class types
13241314
that behave as integer types do, as defined below.
13251315

@@ -1332,25 +1322,25 @@
13321322
otherwise, it is an \defnadj{unsigned-integer-class}{type}.
13331323

13341324
\pnum
1335-
For every integer-class type \tcode{I},
1336-
let \tcode{B(I)} be a hypothetical extended integer type
1325+
For every integer-class type \tcode{T},
1326+
let \tcode{B(T)} be a hypothetical extended integer type
13371327
of the same signedness with the smallest width\iref{basic.fundamental}
13381328
capable of representing the same range of values.
1339-
The width of \tcode{I} is equal to the width of \tcode{B(I)}.
1329+
The width of \tcode{T} is equal to the width of \tcode{B(T)}.
13401330

13411331
\pnum
1342-
Let \tcode{a} and \tcode{b} be objects of integer-class type \tcode{I},
1343-
let \tcode{x} and \tcode{y} be objects of type \tcode{B(I)} as described above
1332+
Let \tcode{a} and \tcode{b} be objects of integer-class type \tcode{T},
1333+
let \tcode{x} and \tcode{y} be objects of type \tcode{B(T)} as described above
13441334
that represent the same values as \tcode{a} and \tcode{b} respectively, and
13451335
let \tcode{c} be an lvalue of any integral type.
13461336
\begin{itemize}
13471337
\item
13481338
For every unary operator \tcode{@} for which the expression \tcode{@x}
13491339
is well-formed, \tcode{@a} shall also be well-formed
13501340
and have the same value, effects, and value category as \tcode{@x}
1351-
provided that value is representable by \tcode{I}.
1341+
provided that value is representable by \tcode{T}.
13521342
If \tcode{@x} has type \tcode{bool}, so too does \tcode{@a};
1353-
if \tcode{@x} has type \tcode{B(I)}, then \tcode{@a} has type \tcode{I}.
1343+
if \tcode{@x} has type \tcode{B(T)}, then \tcode{@a} has type \tcode{T}.
13541344
\item
13551345
For every assignment operator \tcode{@=}
13561346
for which \tcode{c @= x} is well-formed,
@@ -1361,9 +1351,9 @@
13611351
For every binary operator \tcode{@} for which \tcode{x @ y} is well-formed,
13621352
\tcode{a @ b} shall also be well-formed and
13631353
shall have the same value, effects, and value category as \tcode{x @ y}
1364-
provided that value is representable by \tcode{I}.
1354+
provided that value is representable by \tcode{T}.
13651355
If \tcode{x @ y} has type \tcode{bool}, so too does \tcode{a @ b};
1366-
if \tcode{x @ y} has type \tcode{B(I)}, then \tcode{a @ b} has type \tcode{I}.
1356+
if \tcode{x @ y} has type \tcode{B(I)}, then \tcode{a @ b} has type \tcode{T}.
13671357
\end{itemize}
13681358

13691359
\pnum
@@ -1375,9 +1365,9 @@
13751365
do not exit via an exception.
13761366

13771367
\pnum
1378-
An expression \tcode{E} of integer-class type \tcode{I} is
1368+
An expression \tcode{E} of integer-class type \tcode{T} is
13791369
contextually convertible to \tcode{bool}
1380-
as if by \tcode{bool(E != I(0))}.
1370+
as if by \tcode{bool(E != T(0))}.
13811371

13821372
\pnum
13831373
All integer-class types model
@@ -1388,44 +1378,56 @@
13881378
A value-initialized object of integer-class type has value 0.
13891379

13901380
\pnum
1391-
For every (possibly cv-qualified) integer-class type \tcode{I},
1392-
\tcode{numeric_limits<I>} is specialized such that:
1381+
For every (possibly cv-qualified) integer-class type \tcode{T},
1382+
\tcode{numeric_limits<T>} is specialized such that:
13931383
\begin{itemize}
13941384
\item
1395-
\tcode{numeric_limits<I>::is_specialized} is \tcode{true},
1385+
\tcode{numeric_limits<T>::is_specialized} is \tcode{true},
13961386
\item
1397-
\tcode{numeric_limits<I>::is_signed} is \tcode{true}
1398-
if and only if \tcode{I} is a signed-integer-class type,
1387+
\tcode{numeric_limits<T>::is_signed} is \tcode{true}
1388+
if and only if \tcode{T} is a signed-integer-class type,
13991389
\item
1400-
\tcode{numeric_limits<I>::is_integer} is \tcode{true},
1390+
\tcode{numeric_limits<T>::is_integer} is \tcode{true},
14011391
\item
1402-
\tcode{numeric_limits<I>::is_exact} is \tcode{true},
1392+
\tcode{numeric_limits<T>::is_exact} is \tcode{true},
14031393
\item
1404-
\tcode{numeric_limits<I>::digits} is equal to the width of the integer-class type,
1394+
\tcode{numeric_limits<T>::digits} is equal to the width of the integer-class type,
14051395
\item
1406-
\tcode{numeric_limits<I>::digits10} is equal to \tcode{static_cast<int>(digits * log10(2))}, and
1396+
\tcode{numeric_limits<T>::digits10} is equal to \tcode{static_cast<int>(digits * log10(2))}, and
14071397
\item
1408-
\tcode{numeric_limits<I>::min()} and \tcode{numeric_limits<I>::max()} return
1409-
the lowest and highest representable values of \tcode{I}, respectively, and
1410-
\tcode{numeric_limits<I>::lowest()} returns \tcode{numeric_limits<I>::\brk{}min()}.
1398+
\tcode{numeric_limits<T>::min()} and \tcode{numeric_limits<T>::max()} return
1399+
the lowest and highest representable values of \tcode{T}, respectively, and
1400+
\tcode{numeric_limits<T>::lowest()} returns \tcode{numeric_limits<T>::\brk{}min()}.
14111401
\end{itemize}
14121402

14131403
\pnum
1414-
A type \tcode{I} other than \cv{}~\tcode{bool} is \defn{integer-like}
1415-
if it models \tcode{\libconcept{integral}<I>} or
1404+
A type \tcode{T} other than \cv{}~\tcode{bool} is \defn{integer-like}
1405+
if it models \tcode{\libconcept{integral}<T>} or
14161406
if it is an integer-class type.
1417-
An integer-like type \tcode{I} is \defn{signed-integer-like}
1418-
if it models \tcode{\libconcept{signed_integral}<I>} or
1407+
An integer-like type \tcode{T} is \defn{signed-integer-like}
1408+
if it models \tcode{\libconcept{signed_integral}<T>} or
14191409
if it is a signed-integer-class type.
1420-
An integer-like type \tcode{I} is \defn{unsigned-integer-like}
1421-
if it models \tcode{\libconcept{unsigned_integral}<I>} or
1410+
An integer-like type \tcode{T} is \defn{unsigned-integer-like}
1411+
if it models \tcode{\libconcept{unsigned_integral}<T>} or
14221412
if it is an unsigned-integer-class type.
14231413

14241414
\pnum
1425-
\tcode{\exposid{is-integer-like}<I>} is \tcode{true}
1426-
if and only if \tcode{I} is an integer-like type.
1427-
\tcode{\exposid{is-signed-integer-like}<I>} is \tcode{true}
1428-
if and only if \tcode{I} is a signed-integer-like type.
1415+
\tcode{\exposid{is-integer-like}<T>} is \tcode{true}
1416+
if and only if \tcode{T} is an integer-like type.
1417+
\tcode{\exposid{is-signed-integer-like}<T>} is \tcode{true}
1418+
if and only if \tcode{T} is a signed-integer-like type.
1419+
1420+
\begin{codeblock}
1421+
template<class I>
1422+
concept @\deflibconcept{weakly_incrementable}@ =
1423+
default_initializable<I> && @\libconcept{movable}@<I> &&
1424+
requires(I i) {
1425+
typename iter_difference_t<I>;
1426+
requires @\exposid{is-signed-integer-like}@<iter_difference_t<I>>;
1427+
{ ++i } -> @\libconcept{same_as}@<I&>; // not required to be equality-preserving
1428+
i++; // not required to be equality-preserving
1429+
};
1430+
\end{codeblock}
14291431

14301432
\pnum
14311433
Let \tcode{i} be an object of type \tcode{I}. When \tcode{i} is in the domain of

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy