Skip to content

Commit d7ca3f6

Browse files
committed
P4037R1 Supporting signed char and unsigned char in random number generation
Fixes NB FR-026-265 (C++26 CD).
1 parent fda5e37 commit d7ca3f6

1 file changed

Lines changed: 34 additions & 40 deletions

File tree

source/numerics.tex

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,62 +1558,56 @@
15581558

15591559
\pnum
15601560
Throughout \ref{rand},
1561-
the effect of instantiating a template:
1561+
where the template parameters are not constrained,
1562+
the names of template parameters are used to express type requirements
1563+
on an instantiated template $T$:
15621564
\begin{itemize}
15631565
\item
1564-
that has a template type parameter
1566+
If \tcode{T} has a template type parameter named
1567+
\tcode{Sseq}, \tcode{URBG}, \tcode{Engine},
1568+
\tcode{RealType}, \tcode{IntType}, or \tcode{UIntType},
1569+
the program is ill-formed if the corresponding template argument is cv-qualified.
1570+
\item
1571+
A template argument corresponding to a template parameter
15651572
named \tcode{Sseq}
1566-
is undefined unless the corresponding template argument
1567-
is cv-unqualified and
1568-
meets the requirements
1573+
shall meet the requirements
15691574
of seed sequence\iref{rand.req.seedseq}.
15701575
\item
1571-
that has a template type parameter
1576+
A template argument corresponding to a template parameter
15721577
named \tcode{URBG}
1573-
is undefined unless the corresponding template argument
1574-
is cv-unqualified and
1575-
meets the requirements
1578+
shall meet the requirements
15761579
of uniform random bit generator\iref{rand.req.urng}.
15771580
\item
1578-
that has a template type parameter
1581+
A template argument corresponding to a template parameter
15791582
named \tcode{Engine}
1580-
is undefined unless the corresponding template argument
1581-
is cv-unqualified and
1582-
meets the requirements
1583+
shall meet the requirements
15831584
of random number engine\iref{rand.req.eng}.
15841585
\item
1585-
that has a template type parameter
1586+
If a template argument corresponding to a template parameter
15861587
named \tcode{RealType}
1587-
is undefined unless the corresponding template argument
1588-
is cv-unqualified and
1589-
is one of
1590-
\tcode{float}, \tcode{double}, or \tcode{long double}.
1588+
is neither
1589+
a standard floating-point type ([basic.fundamental]) nor
1590+
a member of an implementation-defined subset of extended floating-point types,
1591+
the program is ill-formed.
15911592
\item
1592-
that has a template type parameter
1593+
If a template argument corresponding to a template parameter
15931594
named \tcode{IntType}
1594-
is undefined unless the corresponding template argument
1595-
is cv-unqualified and
1596-
is one of
1597-
\tcode{short},
1598-
\tcode{int},
1599-
\tcode{long},
1600-
\tcode{long long},
1601-
\tcode{unsigned short},
1602-
\tcode{unsigned int},
1603-
\tcode{unsigned long},
1604-
or
1605-
\tcode{unsigned long long}.
1595+
is neither
1596+
a standard signed nor a standard unsigned integer type\iref{basic.fundamental}, nor
1597+
an extended integer type whose width is
1598+
greater or equal to that of \tcode{char} and
1599+
less than or equal to that of \tcode{long long}, nor
1600+
a member of an implementation-defined subset of integer types,
1601+
the program is ill-formed.
16061602
\item
1607-
that has a template type parameter
1603+
If a template argument corresponding to a template parameter
16081604
named \tcode{UIntType}
1609-
is undefined unless the corresponding template argument
1610-
is cv-unqualified and
1611-
is one of
1612-
\tcode{unsigned short},
1613-
\tcode{unsigned int},
1614-
\tcode{unsigned long},
1615-
or
1616-
\tcode{unsigned long long}.
1605+
is neither
1606+
a standard or extended unsigned integer type whose width is
1607+
greater or equal to that of \tcode{short} and
1608+
less than or equal to that of \tcode{long long}, nor
1609+
a member of an implementation-defined subset of unsigned integer types,
1610+
the program is ill-formed.
16171611
\end{itemize}
16181612

16191613
\pnum

0 commit comments

Comments
 (0)