Skip to content

Commit

Permalink
Merge 2019-11 LWG Motion 21
Browse files Browse the repository at this point in the history
P1959R0 Remove std::weak_equality and std::strong_equality
  • Loading branch information
zygoloid committed Nov 24, 2019
2 parents eda1581 + ab483d4 commit cbd19c5
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 291 deletions.
2 changes: 1 addition & 1 deletion source/basic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4974,7 +4974,7 @@
\end{note}
The type of a pointer that can designate a function
is called a \defn{function pointer type}.
A pointer to objects of type \tcode{T} is referred to as a ``pointer to
A pointer to an object of type \tcode{T} is referred to as a ``pointer to
\tcode{T}''.
\begin{example}
A pointer to an object of type \tcode{int} is
Expand Down
28 changes: 3 additions & 25 deletions source/classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -6816,18 +6816,6 @@
partial_ordering::unordered
\end{codeblock}

\item
Otherwise, if \tcode{R} is \tcode{strong_equality}, then
\begin{codeblock}
a == b ? strong_equality::equal : strong_equality::nonequal
\end{codeblock}

\item
Otherwise, if \tcode{R} is \tcode{weak_equality}, then
\begin{codeblock}
a == b ? weak_equality::equivalent : weak_equality::nonequivalent
\end{codeblock}

\item
Otherwise, the synthesized three-way comparison is not defined.
\end{itemize}
Expand Down Expand Up @@ -6889,18 +6877,6 @@
is not a comparison category type\iref{cmp.categories},
\tcode{U} is \tcode{void}.

\item
Otherwise, if
at least one $\tcode{T}_i$ is \tcode{std::weak_equality}, or
at least one $\tcode{T}_i$ is \tcode{std::strong_equality} and
at least one $\tcode{T}_j$ is \tcode{std::partial_ordering} or
\tcode{std::weak_ordering},
\tcode{U} is \tcode{std::weak_equality}\iref{cmp.weakeq}.

\item
Otherwise, if at least one $\tcode{T}_i$ is \tcode{std::strong_equality},
\tcode{U} is \tcode{std::strong_equality}\iref{cmp.strongeq}.

\item
Otherwise, if at least one $\tcode{T}_i$ is \tcode{std::partial_ordering},
\tcode{U} is \tcode{std::partial_ordering}\iref{cmp.partialord}.
Expand Down Expand Up @@ -6944,8 +6920,10 @@
\pnum
\begin{example}
\begin{codeblock}
struct HasNoLessThan { };

struct C {
friend std::strong_equality operator<=>(const C&, const C&);
friend HasNoLessThan operator<=>(const C&, const C&);
bool operator<(const C&) const = default; // OK, function is deleted
};
\end{codeblock}
Expand Down
20 changes: 2 additions & 18 deletions source/expressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5955,20 +5955,6 @@
array-to-pointer conversions\iref{conv.array} are not applied.
\end{note}

\pnum
If the composite pointer type is
a function pointer type,
a pointer-to-member type, or
\tcode{std::nullptr_t},
the result is of type \tcode{std::strong_equality};
the result is
\tcode{std::strong_equality::equal}
if the (possibly converted) operands compare equal\iref{expr.eq}
and
\tcode{std::strong_equality::nonequal}
if they compare unequal,
otherwise the result of the operator is unspecified.

\pnum
If the composite pointer type is an object pointer type,
\tcode{p <=> q} is of type \tcode{std::strong_ordering}.
Expand All @@ -5987,12 +5973,10 @@
Otherwise, the program is ill-formed.

\pnum
The five comparison category types\iref{cmp.categories}
The three comparison category types\iref{cmp.categories}
(the types
\tcode{std::strong_ordering},
\tcode{std::strong_equality},
\tcode{std::weak_ordering},
\tcode{std::weak_equality}, and
\tcode{std::weak_ordering}, and
\tcode{std::partial_ordering})
are not predefined;
if the header \libheaderref{compare}
Expand Down
8 changes: 4 additions & 4 deletions source/iterators.tex
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
constexpr bool operator>=(
const reverse_iterator<Iterator1>& x,
const reverse_iterator<Iterator2>& y);
template<class Iterator1, three_way_comparable_with<Iterator1, weak_equality> Iterator2>
template<class Iterator1, three_way_comparable_with<Iterator1> Iterator2>
constexpr compare_three_way_result_t<Iterator1, Iterator2>
operator<=>(const reverse_iterator<Iterator1>& x,
const reverse_iterator<Iterator2>& y);
Expand Down Expand Up @@ -350,7 +350,7 @@
template<class Iterator1, class Iterator2>
constexpr bool operator>=(
const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
template<class Iterator1, three_way_comparable_with<Iterator1, weak_equality> Iterator2>
template<class Iterator1, three_way_comparable_with<Iterator1> Iterator2>
constexpr compare_three_way_result_t<Iterator1, Iterator2>
operator<=>(const move_iterator<Iterator1>& x,
const move_iterator<Iterator2>& y);
Expand Down Expand Up @@ -3526,7 +3526,7 @@

\indexlibrarymember{operator<=>}{reverse_iterator}%
\begin{itemdecl}
template<class Iterator1, three_way_comparable_with<Iterator1, weak_equality> Iterator2>
template<class Iterator1, three_way_comparable_with<Iterator1> Iterator2>
constexpr compare_three_way_result_t<Iterator1, Iterator2>
operator<=>(const reverse_iterator<Iterator1>& x,
const reverse_iterator<Iterator2>& y);
Expand Down Expand Up @@ -4470,7 +4470,7 @@

\indexlibrarymember{operator<=>}{move_iterator}%
\begin{itemdecl}
template<class Iterator1, three_way_comparable_with<Iterator1, weak_equality> Iterator2>
template<class Iterator1, three_way_comparable_with<Iterator1> Iterator2>
constexpr compare_three_way_result_t<Iterator1, Iterator2>
operator<=>(const move_iterator<Iterator1>& x,
const move_iterator<Iterator2>& y);
Expand Down
5 changes: 2 additions & 3 deletions source/overloading.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4114,9 +4114,8 @@
is a pointer-to-member type or \tcode{std::nullptr_t},
there exist candidate operator functions of the form
\begin{codeblock}
bool operator==(@\placeholder{T}@, @\placeholder{T}@);
bool operator!=(@\placeholder{T}@, @\placeholder{T}@);
std::strong_equality operator<=>(@\placeholder{T}@, @\placeholder{T}@);
bool operator==(@\placeholder{T}@, @\placeholder{T}@);
bool operator!=(@\placeholder{T}@, @\placeholder{T}@);
\end{codeblock}

\pnum
Expand Down
Loading

0 comments on commit cbd19c5

Please sign in to comment.