Skip to content

Commit 75b3ba4

Browse files
committed
Merge 2018-03 CWG Motion 9
2 parents 56abf8f + 5466df9 commit 75b3ba4

File tree

2 files changed

+119
-8
lines changed

2 files changed

+119
-8
lines changed

source/overloading.tex

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,21 +1062,33 @@
10621062
union of the member candidates, the non-member candidates, and
10631063
the built-in candidates for that operator \tcode{@}.
10641064
If that operator is a
1065-
relational\iref{expr.rel} or equality\iref{expr.eq} operator
1065+
relational\iref{expr.rel},
1066+
equality\iref{expr.eq},
1067+
or three-way comparison\iref{expr.spaceship}
1068+
operator
10661069
with operands \tcode{x} and \tcode{y},
10671070
then for each member, non-member, or built-in candidate
10681071
for the operator \tcode{<=>}:
10691072
\begin{itemize}
10701073
\item
10711074
that operator is added to the set of candidate functions for overload resolution
1072-
if \tcode{x <=> y @ 0} is well-formed using that \tcode{operator<=>}; and
1075+
if \tcode{@} is not \tcode{<=>}
1076+
and \tcode{(x <=> y) @ 0} is well-formed using that \tcode{operator<=>}; and
10731077
\item
10741078
a synthesized candidate is added to the candidate set
10751079
where the order of the two parameters is reversed
1076-
if \tcode{0 @ y <=> x} is well-formed using that \tcode{operator<=>};
1080+
if \tcode{0 @ (y <=> x)} is well-formed using that \tcode{operator<=>};
1081+
\end{itemize}
1082+
where in each case,
1083+
\begin{itemize}
1084+
\item if \tcode{@} is not \tcode{<=>},
1085+
\tcode{operator<=>} candidates
1086+
are not considered for the recursive lookup of operator \tcode{@}
1087+
and
1088+
\item
1089+
synthesized \tcode{operator<=>} candidates
1090+
are not considered for the recursive lookups.
10771091
\end{itemize}
1078-
where in each case \tcode{operator<=>} candidates
1079-
are not considered for the recursive lookup of operator \tcode{@}.
10801092

10811093
\pnum
10821094
The argument list contains all of the
@@ -1102,12 +1114,11 @@
11021114
\pnum
11031115
If an \tcode{operator<=>} candidate
11041116
is selected by overload resolution for an operator \tcode{@},
1105-
but \tcode{@} is not \tcode{<=>},
11061117
\tcode{x @ y}
1107-
is interpreted as \tcode{0 @ y <=> x}
1118+
is interpreted as \tcode{0 @ (y <=> x)}
11081119
if the selected candidate is a synthesized candidate
11091120
with reversed order of parameters,
1110-
or \tcode{x <=> y @ 0} otherwise,
1121+
or \tcode{(x <=> y) @ 0} if \tcode{@} is not \tcode{<=>},
11111122
using the selected \tcode{operator<=>} candidate.
11121123

11131124
\pnum

source/support.tex

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3829,6 +3829,8 @@
38293829
friend constexpr bool operator!=(weak_equality v, @\unspec@) noexcept;
38303830
friend constexpr bool operator==(@\unspec@, weak_equality v) noexcept;
38313831
friend constexpr bool operator!=(@\unspec@, weak_equality v) noexcept;
3832+
friend constexpr weak_equality operator<=>(weak_equality v, @\unspec@) noexcept;
3833+
friend constexpr weak_equality operator<=>(@\unspec@, weak_equality v) noexcept;
38323834
};
38333835

38343836
// valid values' definitions
@@ -3861,6 +3863,18 @@
38613863
\tcode{v.value != 0}.
38623864
\end{itemdescr}
38633865

3866+
\indexlibrarymember{operator<=>}{weak_equality}%
3867+
\begin{itemdecl}
3868+
constexpr weak_equality operator<=>(weak_equality v, @\unspec@) noexcept;
3869+
constexpr weak_equality operator<=>(@\unspec@, weak_equality v) noexcept;
3870+
\end{itemdecl}
3871+
3872+
\begin{itemdescr}
3873+
\pnum
3874+
\returns
3875+
\tcode{v}.
3876+
\end{itemdescr}
3877+
38643878
\rSec3[cmp.strongeq]{Class \tcode{strong_equality}}
38653879

38663880
\pnum
@@ -3897,6 +3911,8 @@
38973911
friend constexpr bool operator!=(strong_equality v, @\unspec@) noexcept;
38983912
friend constexpr bool operator==(@\unspec@, strong_equality v) noexcept;
38993913
friend constexpr bool operator!=(@\unspec@, strong_equality v) noexcept;
3914+
friend constexpr strong_equality operator<=>(strong_equality v, @\unspec@) noexcept;
3915+
friend constexpr strong_equality operator<=>(@\unspec@, strong_equality v) noexcept;
39003916
};
39013917

39023918
// valid values' definitions
@@ -3942,6 +3958,18 @@
39423958
\tcode{v.value != 0}.
39433959
\end{itemdescr}
39443960

3961+
\indexlibrarymember{operator<=>}{strong_equality}%
3962+
\begin{itemdecl}
3963+
constexpr strong_equality operator<=>(strong_equality v, @\unspec@) noexcept;
3964+
constexpr strong_equality operator<=>(@\unspec@, strong_equality v) noexcept;
3965+
\end{itemdecl}
3966+
3967+
\begin{itemdescr}
3968+
\pnum
3969+
\returns
3970+
\tcode{v}.
3971+
\end{itemdescr}
3972+
39453973
\rSec3[cmp.partialord]{Class \tcode{partial_ordering}}
39463974

39473975
\pnum
@@ -3994,6 +4022,8 @@
39944022
friend constexpr bool operator<=(@\unspec@, partial_ordering v) noexcept;
39954023
friend constexpr bool operator> (@\unspec@, partial_ordering v) noexcept;
39964024
friend constexpr bool operator>=(@\unspec@, partial_ordering v) noexcept;
4025+
friend constexpr partial_ordering operator<=>(partial_ordering v, @\unspec@) noexcept;
4026+
friend constexpr partial_ordering operator<=>(@\unspec@, partial_ordering v) noexcept;
39974027
};
39984028

39994029
// valid values' definitions
@@ -4068,6 +4098,28 @@
40684098
For \tcode{operator@}, \tcode{!v.is_ordered || v.value != 0}.
40694099
\end{itemdescr}
40704100

4101+
\indexlibrarymember{operator<=>}{partial_ordering}%
4102+
\begin{itemdecl}
4103+
constexpr partial_ordering operator<=>(partial_ordering v, @\unspec@) noexcept;
4104+
\end{itemdecl}
4105+
4106+
\begin{itemdescr}
4107+
\pnum
4108+
\returns
4109+
\tcode{v}.
4110+
\end{itemdescr}
4111+
4112+
\indexlibrarymember{operator<=>}{partial_ordering}%
4113+
\begin{itemdecl}
4114+
constexpr partial_ordering operator<=>(@\unspec@, partial_ordering v) noexcept;
4115+
\end{itemdecl}
4116+
4117+
\begin{itemdescr}
4118+
\pnum
4119+
\returns
4120+
\tcode{v < 0 ?\ partial_ordering::greater :\ v > 0 ?\ partial_ordering::less :\ v}.
4121+
\end{itemdescr}
4122+
40714123
\rSec3[cmp.weakord]{Class \tcode{weak_ordering}}
40724124

40734125
\pnum
@@ -4112,6 +4164,8 @@
41124164
friend constexpr bool operator<=(@\unspec@, weak_ordering v) noexcept;
41134165
friend constexpr bool operator> (@\unspec@, weak_ordering v) noexcept;
41144166
friend constexpr bool operator>=(@\unspec@, weak_ordering v) noexcept;
4167+
friend constexpr weak_ordering operator<=>(weak_ordering v, @\unspec@) noexcept;
4168+
friend constexpr weak_ordering operator<=>(@\unspec@, weak_ordering v) noexcept;
41154169
};
41164170

41174171
// valid values' definitions
@@ -4189,6 +4243,28 @@
41894243
\tcode{0 @ v.value} for \tcode{operator@}.
41904244
\end{itemdescr}
41914245

4246+
\indexlibrarymember{operator<=>}{weak_ordering}%
4247+
\begin{itemdecl}
4248+
constexpr weak_ordering operator<=>(weak_ordering v, @\unspec@) noexcept;
4249+
\end{itemdecl}
4250+
4251+
\begin{itemdescr}
4252+
\pnum
4253+
\returns
4254+
\tcode{v}.
4255+
\end{itemdescr}
4256+
4257+
\indexlibrarymember{operator<=>}{weak_ordering}%
4258+
\begin{itemdecl}
4259+
constexpr weak_ordering operator<=>(@\unspec@, weak_ordering v) noexcept;
4260+
\end{itemdecl}
4261+
4262+
\begin{itemdescr}
4263+
\pnum
4264+
\returns
4265+
\tcode{v < 0 ?\ weak_ordering::greater :\ v > 0 ?\ weak_ordering::less :\ v}.
4266+
\end{itemdescr}
4267+
41924268
\rSec3[cmp.strongord]{Class \tcode{strong_ordering}}
41934269

41944270
\pnum
@@ -4237,6 +4313,8 @@
42374313
friend constexpr bool operator<=(@\unspec@, strong_ordering v) noexcept;
42384314
friend constexpr bool operator> (@\unspec@, strong_ordering v) noexcept;
42394315
friend constexpr bool operator>=(@\unspec@, strong_ordering v) noexcept;
4316+
friend constexpr strong_ordering operator<=>(strong_ordering v, @\unspec@) noexcept;
4317+
friend constexpr strong_ordering operator<=>(@\unspec@, strong_ordering v) noexcept;
42404318
};
42414319

42424320
// valid values' definitions
@@ -4341,6 +4419,28 @@
43414419
\tcode{0 @ v.value} for \tcode{operator@}.
43424420
\end{itemdescr}
43434421

4422+
\indexlibrarymember{operator<=>}{strong_ordering}%
4423+
\begin{itemdecl}
4424+
constexpr strong_ordering operator<=>(strong_ordering v, @\unspec@) noexcept;
4425+
\end{itemdecl}
4426+
4427+
\begin{itemdescr}
4428+
\pnum
4429+
\returns
4430+
\tcode{v}.
4431+
\end{itemdescr}
4432+
4433+
\indexlibrarymember{operator<=>}{strong_ordering}%
4434+
\begin{itemdecl}
4435+
constexpr strong_ordering operator<=>(@\unspec@, strong_ordering v) noexcept;
4436+
\end{itemdecl}
4437+
4438+
\begin{itemdescr}
4439+
\pnum
4440+
\returns
4441+
\tcode{v < 0 ?\ strong_ordering::greater :\ v > 0 ?\ strong_ordering::less :\ v}.
4442+
\end{itemdescr}
4443+
43444444
\rSec2[cmp.common]{Class template \tcode{common_comparison_category}}
43454445

43464446
\pnum

0 commit comments

Comments
 (0)