|
1306 | 1306 |
|
1307 | 1307 | template<class T>
|
1308 | 1308 | 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 |
| - }; |
1319 | 1309 | \end{codeblock}
|
1320 | 1310 |
|
1321 | 1311 | \pnum
|
1322 |
| -A type \tcode{I} is an \defnadj{integer-class}{type} |
| 1312 | +A type \tcode{T} is an \defnadj{integer-class}{type} |
1323 | 1313 | if it is in a set of \impldef{integer-class type} class types
|
1324 | 1314 | that behave as integer types do, as defined below.
|
1325 | 1315 |
|
|
1332 | 1322 | otherwise, it is an \defnadj{unsigned-integer-class}{type}.
|
1333 | 1323 |
|
1334 | 1324 | \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 |
1337 | 1327 | of the same signedness with the smallest width\iref{basic.fundamental}
|
1338 | 1328 | 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)}. |
1340 | 1330 |
|
1341 | 1331 | \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 |
1344 | 1334 | that represent the same values as \tcode{a} and \tcode{b} respectively, and
|
1345 | 1335 | let \tcode{c} be an lvalue of any integral type.
|
1346 | 1336 | \begin{itemize}
|
1347 | 1337 | \item
|
1348 | 1338 | For every unary operator \tcode{@} for which the expression \tcode{@x}
|
1349 | 1339 | is well-formed, \tcode{@a} shall also be well-formed
|
1350 | 1340 | 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}. |
1352 | 1342 | 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}. |
1354 | 1344 | \item
|
1355 | 1345 | For every assignment operator \tcode{@=}
|
1356 | 1346 | for which \tcode{c @= x} is well-formed,
|
|
1361 | 1351 | For every binary operator \tcode{@} for which \tcode{x @ y} is well-formed,
|
1362 | 1352 | \tcode{a @ b} shall also be well-formed and
|
1363 | 1353 | 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}. |
1365 | 1355 | 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}. |
1367 | 1357 | \end{itemize}
|
1368 | 1358 |
|
1369 | 1359 | \pnum
|
|
1375 | 1365 | do not exit via an exception.
|
1376 | 1366 |
|
1377 | 1367 | \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 |
1379 | 1369 | contextually convertible to \tcode{bool}
|
1380 |
| -as if by \tcode{bool(E != I(0))}. |
| 1370 | +as if by \tcode{bool(E != T(0))}. |
1381 | 1371 |
|
1382 | 1372 | \pnum
|
1383 | 1373 | All integer-class types model
|
|
1388 | 1378 | A value-initialized object of integer-class type has value 0.
|
1389 | 1379 |
|
1390 | 1380 | \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: |
1393 | 1383 | \begin{itemize}
|
1394 | 1384 | \item
|
1395 |
| - \tcode{numeric_limits<I>::is_specialized} is \tcode{true}, |
| 1385 | + \tcode{numeric_limits<T>::is_specialized} is \tcode{true}, |
1396 | 1386 | \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, |
1399 | 1389 | \item
|
1400 |
| - \tcode{numeric_limits<I>::is_integer} is \tcode{true}, |
| 1390 | + \tcode{numeric_limits<T>::is_integer} is \tcode{true}, |
1401 | 1391 | \item
|
1402 |
| - \tcode{numeric_limits<I>::is_exact} is \tcode{true}, |
| 1392 | + \tcode{numeric_limits<T>::is_exact} is \tcode{true}, |
1403 | 1393 | \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, |
1405 | 1395 | \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 |
1407 | 1397 | \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()}. |
1411 | 1401 | \end{itemize}
|
1412 | 1402 |
|
1413 | 1403 | \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 |
1416 | 1406 | 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 |
1419 | 1409 | 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 |
1422 | 1412 | if it is an unsigned-integer-class type.
|
1423 | 1413 |
|
1424 | 1414 | \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} |
1429 | 1431 |
|
1430 | 1432 | \pnum
|
1431 | 1433 | Let \tcode{i} be an object of type \tcode{I}. When \tcode{i} is in the domain of
|
|
0 commit comments