Skip to content

Commit ac12ee0

Browse files
committed
P1961R0 Harmonizing the definitions of total order for pointers
Also fixes NB US 176, US 220 (C++20 CD)
1 parent 81f1d68 commit ac12ee0

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
@@ -4899,8 +4899,8 @@
48994899
a call to a built-in operator \tcode{<=>} comparing pointers of type \tcode{P},
49004900
returns \tcode{strong_ordering::less}
49014901
if (the converted value of) \tcode{t} precedes \tcode{u}
4902-
in the implementation-defined strict total order\iref{range.cmp}
4903-
over pointers of type \tcode{P},
4902+
in the implementation-defined strict total order
4903+
over pointers\iref{defns.order.ptr},
49044904
\tcode{strong_ordering::greater}
49054905
if \tcode{u} precedes \tcode{t}, and
49064906
otherwise \tcode{strong_ordering::equal}.

source/utilities.tex

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

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

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

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

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

1467714669
\item

0 commit comments

Comments
 (0)