Skip to content

Commit 24107cd

Browse files
jensmaurerzygoloid
authored andcommitted
P1961R0 Harmonizing the definitions of total order for pointers
Also fixes NB US 176, US 220 (C++20 CD)
1 parent f49b44c commit 24107cd

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

source/lib-intro.tex

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,15 @@
260260
handler functions\iref{language.support}.
261261
\end{defnote}
262262

263+
\definition{implementation-defined strict total order over pointers}
264+
{defns.order.ptr}
265+
\indexdefn{pointer!strict total order}%
266+
\impldef{strict total order over pointer values}
267+
strict total ordering over all pointer values
268+
such that the ordering is consistent with the partial order
269+
imposed by the builtin operators
270+
\tcode{<}, \tcode{>}, \tcode{<=}, \tcode{>=}, and \tcode{<=>}
271+
263272
\definition{iostream class templates}{defns.iostream.templates}
264273
templates, defined in \ref{input.output},
265274
that take two template arguments

source/support.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4900,8 +4900,8 @@
49004900
a call to a built-in operator \tcode{<=>} comparing pointers of type \tcode{P},
49014901
returns \tcode{strong_ordering::less}
49024902
if (the converted value of) \tcode{t} precedes \tcode{u}
4903-
in the implementation-defined strict total order\iref{range.cmp}
4904-
over pointers of type \tcode{P},
4903+
in the implementation-defined strict total order
4904+
over pointers\iref{defns.order.ptr},
49054905
\tcode{strong_ordering::greater}
49064906
if \tcode{u} precedes \tcode{t}, and
49074907
otherwise \tcode{strong_ordering::equal}.

source/utilities.tex

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14283,21 +14283,19 @@
1428314283
\pnum
1428414284
For templates \tcode{less}, \tcode{greater}, \tcode{less_equal}, and
1428514285
\tcode{greater_equal}, the specializations for any pointer type
14286-
yield a strict total order that is consistent among those specializations and
14287-
is also consistent with the partial order imposed by
14288-
the built-in operators \tcode{<}, \tcode{>}, \tcode{<=}, \tcode{>=}.
14286+
yield a result consistent with the
14287+
implementation-defined strict total order over pointers\iref{defns.order.ptr}.
1428914288
\begin{note}
14290-
When \tcode{a < b} is well-defined
14289+
If \tcode{a < b} is well-defined
1429114290
for pointers \tcode{a} and \tcode{b} of type \tcode{P},
14292-
this implies \tcode{(a < b) == less<P>()(a, b)},
14291+
then \tcode{(a < b) == less<P>()(a, b)},
1429314292
\tcode{(a > b) == greater<P>()(a, b)}, and so forth.
1429414293
\end{note}
1429514294
For template specializations \tcode{less<void>}, \tcode{greater<void>},
1429614295
\tcode{less_equal<void>}, and \tcode{greater_equal<void>},
1429714296
if the call operator calls a built-in operator comparing pointers,
14298-
the call operator yields a strict total order
14299-
that is consistent among those specializations and
14300-
is also consistent with the partial order imposed by those built-in operators.
14297+
the call operator yields a result consistent
14298+
with the implementation-defined strict total order over pointers.
1430114299

1430214300
\rSec3[comparisons.equal.to]{Class template \tcode{equal_to}}
1430314301

@@ -14561,12 +14559,6 @@
1456114559
in the expression \tcode{declval<T>() $op$ declval<U>()} resolves to a built-in
1456214560
operator comparing pointers.
1456314561

14564-
\pnum
14565-
There is an implementation-defined strict total ordering over all pointer values
14566-
of a given type. This total ordering is consistent with the partial order imposed
14567-
by the builtin operators \tcode{<}, \tcode{>}, \tcode{<=}, \tcode{>=}, and
14568-
\tcode{<=>}.
14569-
1457014562
\indexlibraryglobal{equal_to}%
1457114563
\begin{itemdecl}
1457214564
struct ranges::equal_to {
@@ -14594,7 +14586,7 @@
1459414586
a call to a built-in operator \tcode{==} comparing pointers of type \tcode{P}:
1459514587
returns \tcode{false} if either (the converted value of) \tcode{t} precedes
1459614588
\tcode{u} or \tcode{u} precedes \tcode{t} in the implementation-defined strict
14597-
total order over pointers of type \tcode{P} and otherwise \tcode{true}.
14589+
total order over pointers\iref{defns.order.ptr} and otherwise \tcode{true}.
1459814590

1459914591
\item
1460014592
Otherwise, equivalent to:
@@ -14672,7 +14664,7 @@
1467214664
If the expression \tcode{std::forward<T>(t) < std::forward<U>(u)} results in a
1467314665
call to a built-in operator \tcode{<} comparing pointers of type \tcode{P}:
1467414666
returns \tcode{true} if (the converted value of) \tcode{t} precedes \tcode{u} in
14675-
the implementation-defined strict total order over pointers of type \tcode{P}
14667+
the implementation-defined strict total order over pointers\iref{defns.order.ptr}
1467614668
and otherwise \tcode{false}.
1467714669

1467814670
\item

0 commit comments

Comments
 (0)