Skip to content

P1961R0 Harmonizing the definitions of total order for pointers #3449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions source/lib-intro.tex
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,15 @@
handler functions\iref{language.support}.
\end{defnote}

\definition{implementation-defined strict total order over pointers}
{defns.order.ptr}
\indexdefn{pointer!strict total order}%
\impldef{strict total order over pointer values}
strict total ordering over all pointer values
such that the ordering is consistent with the partial order
imposed by the builtin operators
\tcode{<}, \tcode{>}, \tcode{<=}, \tcode{>=}, and \tcode{<=>}

\definition{iostream class templates}{defns.iostream.templates}
templates, defined in \ref{input.output},
that take two template arguments
Expand Down
4 changes: 2 additions & 2 deletions source/support.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4900,8 +4900,8 @@
a call to a built-in operator \tcode{<=>} comparing pointers of type \tcode{P},
returns \tcode{strong_ordering::less}
if (the converted value of) \tcode{t} precedes \tcode{u}
in the implementation-defined strict total order\iref{range.cmp}
over pointers of type \tcode{P},
in the implementation-defined strict total order
over pointers\iref{defns.order.ptr},
\tcode{strong_ordering::greater}
if \tcode{u} precedes \tcode{t}, and
otherwise \tcode{strong_ordering::equal}.
Expand Down
28 changes: 10 additions & 18 deletions source/utilities.tex
Original file line number Diff line number Diff line change
Expand Up @@ -14283,21 +14283,19 @@
\pnum
For templates \tcode{less}, \tcode{greater}, \tcode{less_equal}, and
\tcode{greater_equal}, the specializations for any pointer type
yield a strict total order that is consistent among those specializations and
is also consistent with the partial order imposed by
the built-in operators \tcode{<}, \tcode{>}, \tcode{<=}, \tcode{>=}.
yield a result consistent with the
implementation-defined strict total order over pointers\iref{defns.order.ptr}.
\begin{note}
When \tcode{a < b} is well-defined
If \tcode{a < b} is well-defined
for pointers \tcode{a} and \tcode{b} of type \tcode{P},
this implies \tcode{(a < b) == less<P>()(a, b)},
then \tcode{(a < b) == less<P>()(a, b)},
\tcode{(a > b) == greater<P>()(a, b)}, and so forth.
\end{note}
For template specializations \tcode{less<void>}, \tcode{greater<void>},
\tcode{less_equal<void>}, and \tcode{greater_equal<void>},
if the call operator calls a built-in operator comparing pointers,
the call operator yields a strict total order
that is consistent among those specializations and
is also consistent with the partial order imposed by those built-in operators.
the call operator yields a result consistent
with the implementation-defined strict total order over pointers.

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

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

\pnum
There is an implementation-defined strict total ordering over all pointer values
of a given type. This total ordering is consistent with the partial order imposed
by the builtin operators \tcode{<}, \tcode{>}, \tcode{<=}, \tcode{>=}, and
\tcode{<=>}.

\indexlibraryglobal{equal_to}%
\begin{itemdecl}
struct ranges::equal_to {
Expand All @@ -14591,10 +14583,10 @@
\begin{itemize}
\item
If the expression \tcode{std::forward<T>(t) == std::forward<U>(u)} results in
a call to a built-in operator \tcode{==} comparing pointers of type \tcode{P}:
a call to a built-in operator \tcode{==} comparing pointers:
returns \tcode{false} if either (the converted value of) \tcode{t} precedes
\tcode{u} or \tcode{u} precedes \tcode{t} in the implementation-defined strict
total order over pointers of type \tcode{P} and otherwise \tcode{true}.
total order over pointers\iref{defns.order.ptr} and otherwise \tcode{true}.

\item
Otherwise, equivalent to:
Expand Down Expand Up @@ -14670,9 +14662,9 @@
\begin{itemize}
\item
If the expression \tcode{std::forward<T>(t) < std::forward<U>(u)} results in a
call to a built-in operator \tcode{<} comparing pointers of type \tcode{P}:
call to a built-in operator \tcode{<} comparing pointers:
returns \tcode{true} if (the converted value of) \tcode{t} precedes \tcode{u} in
the implementation-defined strict total order over pointers of type \tcode{P}
the implementation-defined strict total order over pointers\iref{defns.order.ptr}
and otherwise \tcode{false}.

\item
Expand Down