|
1312 | 1312 |
|
1313 | 1313 | template<class T>
|
1314 | 1314 | inline constexpr bool @\exposid{is-signed-integer-like}@ = @\seebelow@; @\itcorr[-2]@ // \expos
|
1315 |
| - |
1316 |
| -template<class I> |
1317 |
| - concept @\deflibconcept{weakly_incrementable}@ = |
1318 |
| - @\libconcept{default_initializable}@<I> && @\libconcept{movable}@<I> && |
1319 |
| - requires(I i) { |
1320 |
| - typename iter_difference_t<I>; |
1321 |
| - requires @\exposid{is-signed-integer-like}@<iter_difference_t<I>>; |
1322 |
| - { ++i } -> @\libconcept{same_as}@<I&>; // not required to be equality-preserving |
1323 |
| - i++; // not required to be equality-preserving |
1324 |
| - }; |
1325 | 1315 | \end{codeblock}
|
1326 | 1316 |
|
1327 | 1317 | \pnum
|
1328 |
| -A type \tcode{I} is an \defnadj{integer-class}{type} |
| 1318 | +A type \tcode{T} is an \defnadj{integer-class}{type} |
1329 | 1319 | if it is in a set of \impldef{integer-class type} class types
|
1330 | 1320 | that behave as integer types do, as defined below.
|
1331 | 1321 |
|
|
1338 | 1328 | otherwise, it is an \defnadj{unsigned-integer-class}{type}.
|
1339 | 1329 |
|
1340 | 1330 | \pnum
|
1341 |
| -For every integer-class type \tcode{I}, |
1342 |
| -let \tcode{B(I)} be a hypothetical extended integer type |
| 1331 | +For every integer-class type \tcode{T}, |
| 1332 | +let \tcode{B(T)} be a hypothetical extended integer type |
1343 | 1333 | of the same signedness with the smallest width\iref{basic.fundamental}
|
1344 | 1334 | capable of representing the same range of values.
|
1345 |
| -The width of \tcode{I} is equal to the width of \tcode{B(I)}. |
| 1335 | +The width of \tcode{T} is equal to the width of \tcode{B(T)}. |
1346 | 1336 |
|
1347 | 1337 | \pnum
|
1348 |
| -Let \tcode{a} and \tcode{b} be objects of integer-class type \tcode{I}, |
1349 |
| -let \tcode{x} and \tcode{y} be objects of type \tcode{B(I)} as described above |
| 1338 | +Let \tcode{a} and \tcode{b} be objects of integer-class type \tcode{T}, |
| 1339 | +let \tcode{x} and \tcode{y} be objects of type \tcode{B(T)} as described above |
1350 | 1340 | that represent the same values as \tcode{a} and \tcode{b} respectively, and
|
1351 | 1341 | let \tcode{c} be an lvalue of any integral type.
|
1352 | 1342 | \begin{itemize}
|
1353 | 1343 | \item
|
1354 | 1344 | For every unary operator \tcode{@} for which the expression \tcode{@x}
|
1355 | 1345 | is well-formed, \tcode{@a} shall also be well-formed
|
1356 | 1346 | and have the same value, effects, and value category as \tcode{@x}
|
1357 |
| - provided that value is representable by \tcode{I}. |
| 1347 | + provided that value is representable by \tcode{T}. |
1358 | 1348 | If \tcode{@x} has type \tcode{bool}, so too does \tcode{@a};
|
1359 |
| - if \tcode{@x} has type \tcode{B(I)}, then \tcode{@a} has type \tcode{I}. |
| 1349 | + if \tcode{@x} has type \tcode{B(T)}, then \tcode{@a} has type \tcode{T}. |
1360 | 1350 | \item
|
1361 | 1351 | For every assignment operator \tcode{@=}
|
1362 | 1352 | for which \tcode{c @= x} is well-formed,
|
|
1367 | 1357 | For every binary operator \tcode{@} for which \tcode{x @ y} is well-formed,
|
1368 | 1358 | \tcode{a @ b} shall also be well-formed and
|
1369 | 1359 | shall have the same value, effects, and value category as \tcode{x @ y}
|
1370 |
| - provided that value is representable by \tcode{I}. |
| 1360 | + provided that value is representable by \tcode{T}. |
1371 | 1361 | If \tcode{x @ y} has type \tcode{bool}, so too does \tcode{a @ b};
|
1372 |
| - if \tcode{x @ y} has type \tcode{B(I)}, then \tcode{a @ b} has type \tcode{I}. |
| 1362 | + if \tcode{x @ y} has type \tcode{B(T)}, then \tcode{a @ b} has type \tcode{T}. |
1373 | 1363 | \end{itemize}
|
1374 | 1364 |
|
1375 | 1365 | \pnum
|
|
1381 | 1371 | do not exit via an exception.
|
1382 | 1372 |
|
1383 | 1373 | \pnum
|
1384 |
| -An expression \tcode{E} of integer-class type \tcode{I} is |
| 1374 | +An expression \tcode{E} of integer-class type \tcode{T} is |
1385 | 1375 | contextually convertible to \tcode{bool}
|
1386 |
| -as if by \tcode{bool(E != I(0))}. |
| 1376 | +as if by \tcode{bool(E != T(0))}. |
1387 | 1377 |
|
1388 | 1378 | \pnum
|
1389 | 1379 | All integer-class types model
|
|
1394 | 1384 | A value-initialized object of integer-class type has value 0.
|
1395 | 1385 |
|
1396 | 1386 | \pnum
|
1397 |
| -For every (possibly cv-qualified) integer-class type \tcode{I}, |
1398 |
| -\tcode{numeric_limits<I>} is specialized such that: |
| 1387 | +For every (possibly cv-qualified) integer-class type \tcode{T}, |
| 1388 | +\tcode{numeric_limits<T>} is specialized such that: |
1399 | 1389 | \begin{itemize}
|
1400 | 1390 | \item
|
1401 |
| - \tcode{numeric_limits<I>::is_specialized} is \tcode{true}, |
| 1391 | + \tcode{numeric_limits<T>::is_specialized} is \tcode{true}, |
1402 | 1392 | \item
|
1403 |
| - \tcode{numeric_limits<I>::is_signed} is \tcode{true} |
1404 |
| - if and only if \tcode{I} is a signed-integer-class type, |
| 1393 | + \tcode{numeric_limits<T>::is_signed} is \tcode{true} |
| 1394 | + if and only if \tcode{T} is a signed-integer-class type, |
1405 | 1395 | \item
|
1406 |
| - \tcode{numeric_limits<I>::is_integer} is \tcode{true}, |
| 1396 | + \tcode{numeric_limits<T>::is_integer} is \tcode{true}, |
1407 | 1397 | \item
|
1408 |
| - \tcode{numeric_limits<I>::is_exact} is \tcode{true}, |
| 1398 | + \tcode{numeric_limits<T>::is_exact} is \tcode{true}, |
1409 | 1399 | \item
|
1410 |
| - \tcode{numeric_limits<I>::digits} is equal to the width of the integer-class type, |
| 1400 | + \tcode{numeric_limits<T>::digits} is equal to the width of the integer-class type, |
1411 | 1401 | \item
|
1412 |
| - \tcode{numeric_limits<I>::digits10} is equal to \tcode{static_cast<int>(digits * log10(2))}, and |
| 1402 | + \tcode{numeric_limits<T>::digits10} is equal to \tcode{static_cast<int>(digits * log10(2))}, and |
1413 | 1403 | \item
|
1414 |
| - \tcode{numeric_limits<I>::min()} and \tcode{numeric_limits<I>::max()} return |
1415 |
| - the lowest and highest representable values of \tcode{I}, respectively, and |
1416 |
| - \tcode{numeric_limits<I>::lowest()} returns \tcode{numeric_limits<I>::\brk{}min()}. |
| 1404 | + \tcode{numeric_limits<T>::min()} and \tcode{numeric_limits<T>::max()} return |
| 1405 | + the lowest and highest representable values of \tcode{T}, respectively, and |
| 1406 | + \tcode{numeric_limits<T>::lowest()} returns \tcode{numeric_limits<T>::\brk{}min()}. |
1417 | 1407 | \end{itemize}
|
1418 | 1408 |
|
1419 | 1409 | \pnum
|
1420 |
| -A type \tcode{I} other than \cv{}~\tcode{bool} is \defn{integer-like} |
1421 |
| -if it models \tcode{\libconcept{integral}<I>} or |
| 1410 | +A type \tcode{T} other than \cv{}~\tcode{bool} is \defn{integer-like} |
| 1411 | +if it models \tcode{\libconcept{integral}<T>} or |
1422 | 1412 | if it is an integer-class type.
|
1423 |
| -An integer-like type \tcode{I} is \defn{signed-integer-like} |
1424 |
| -if it models \tcode{\libconcept{signed_integral}<I>} or |
| 1413 | +An integer-like type \tcode{T} is \defn{signed-integer-like} |
| 1414 | +if it models \tcode{\libconcept{signed_integral}<T>} or |
1425 | 1415 | if it is a signed-integer-class type.
|
1426 |
| -An integer-like type \tcode{I} is \defn{unsigned-integer-like} |
1427 |
| -if it models \tcode{\libconcept{unsigned_integral}<I>} or |
| 1416 | +An integer-like type \tcode{T} is \defn{unsigned-integer-like} |
| 1417 | +if it models \tcode{\libconcept{unsigned_integral}<T>} or |
1428 | 1418 | if it is an unsigned-integer-class type.
|
1429 | 1419 |
|
1430 | 1420 | \pnum
|
1431 |
| -\tcode{\exposid{is-integer-like}<I>} is \tcode{true} |
1432 |
| -if and only if \tcode{I} is an integer-like type. |
1433 |
| -\tcode{\exposid{is-signed-integer-like}<I>} is \tcode{true} |
1434 |
| -if and only if \tcode{I} is a signed-integer-like type. |
| 1421 | +\tcode{\exposid{is-integer-like}<T>} is \tcode{true} |
| 1422 | +if and only if \tcode{T} is an integer-like type. |
| 1423 | +\tcode{\exposid{is-signed-integer-like}<T>} is \tcode{true} |
| 1424 | +if and only if \tcode{T} is a signed-integer-like type. |
| 1425 | + |
| 1426 | +\begin{codeblock} |
| 1427 | +template<class I> |
| 1428 | + concept @\deflibconcept{weakly_incrementable}@ = |
| 1429 | + @\libconcept{default_initializable}@<I> && @\libconcept{movable}@<I> && |
| 1430 | + requires(I i) { |
| 1431 | + typename iter_difference_t<I>; |
| 1432 | + requires @\exposid{is-signed-integer-like}@<iter_difference_t<I>>; |
| 1433 | + { ++i } -> @\libconcept{same_as}@<I&>; // not required to be equality-preserving |
| 1434 | + i++; // not required to be equality-preserving |
| 1435 | + }; |
| 1436 | +\end{codeblock} |
1435 | 1437 |
|
1436 | 1438 | \pnum
|
1437 | 1439 | Let \tcode{i} be an object of type \tcode{I}. When \tcode{i} is in the domain of
|
|
0 commit comments