Skip to content

Commit 5205bcf

Browse files
jensmaurertkoeppe
authored andcommitted
LWG3530 BUILTIN-PTR-MEOW should not opt the type out of syntactic checks
- Ensure there is an \itemdecl for each operator().
1 parent c3cd733 commit 5205bcf

File tree

1 file changed

+78
-38
lines changed

1 file changed

+78
-38
lines changed

source/utilities.tex

Lines changed: 78 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13978,21 +13978,10 @@
1397813978

1397913979
\rSec3[comparisons.three.way]{Class \tcode{compare_three_way}}
1398013980

13981-
\pnum
13982-
In this subclause, \tcode{\placeholdernc{BUILTIN-PTR-THREE-WAY}(T, U)}
13983-
for types \tcode{T} and \tcode{U} is a boolean constant expression.
13984-
\tcode{\placeholdernc{BUILTIN-PTR-THREE-WAY}(T, U)} is \tcode{true}
13985-
if and only if \tcode{<=>} in the expression
13986-
\begin{codeblock}
13987-
declval<T>() <=> declval<U>()
13988-
\end{codeblock}
13989-
resolves to a built-in operator comparing pointers.
13990-
1399113981
\indexlibraryglobal{compare_three_way}%
1399213982
\begin{codeblock}
1399313983
struct compare_three_way {
1399413984
template<class T, class U>
13995-
requires @\libconcept{three_way_comparable_with}@<T, U> || @\placeholdernc{BUILTIN-PTR-THREE-WAY}@(T, U)
1399613985
constexpr auto operator()(T&& t, U&& u) const;
1399713986

1399813987
using is_transparent = @\unspec@;
@@ -14001,17 +13990,21 @@
1400113990

1400213991
\begin{itemdecl}
1400313992
template<class T, class U>
14004-
requires @\libconcept{three_way_comparable_with}@<T, U> || @\placeholdernc{BUILTIN-PTR-THREE-WAY}@(T, U)
1400513993
constexpr auto operator()(T&& t, U&& u) const;
1400613994
\end{itemdecl}
1400713995

1400813996
\begin{itemdescr}
13997+
\pnum
13998+
\constraints
13999+
\tcode{T} and \tcode{U} satisfy \libconcept{three_way_comparable_with}.
14000+
1400914001
\pnum
1401014002
\expects
1401114003
If the expression \tcode{std::forward<T>(t) <=> std::forward<U>(u)} results in
1401214004
a call to a built-in operator \tcode{<=>} comparing pointers of type \tcode{P},
1401314005
the conversion sequences from both \tcode{T} and \tcode{U} to \tcode{P}
14014-
are equality-preserving\iref{concepts.equality}.
14006+
are equality-preserving\iref{concepts.equality};
14007+
otherwise, \tcode{T} and \tcode{U} model \libconcept{three_way_comparable_with}.
1401514008

1401614009
\pnum
1401714010
\effects
@@ -14033,32 +14026,33 @@
1403314026

1403414027
\rSec2[range.cmp]{Concept-constrained comparisons}
1403514028

14036-
\pnum
14037-
In this subclause, \tcode{\placeholdernc{BUILTIN-PTR-CMP}(T, $op$, U)} for types \tcode{T}
14038-
and \tcode{U} and where $op$ is an equality\iref{expr.eq} or relational
14039-
operator\iref{expr.rel} is a boolean constant expression.
14040-
\tcode{\placeholdernc{BUILTIN-PTR-CMP}(T, $op$, U)} is \tcode{true} if and only if $op$
14041-
in the expression \tcode{declval<T>() $op$ declval<U>()} resolves to a built-in
14042-
operator comparing pointers.
14043-
1404414029
\indexlibraryglobal{equal_to}%
14045-
\begin{itemdecl}
14030+
\begin{codeblock}
1404614031
struct ranges::equal_to {
1404714032
template<class T, class U>
14048-
requires @\libconcept{equality_comparable_with}@<T, U> || @\placeholdernc{BUILTIN-PTR-CMP}@(T, ==, U)
1404914033
constexpr bool operator()(T&& t, U&& u) const;
1405014034

1405114035
using is_transparent = @\unspecnc@;
1405214036
};
14037+
\end{codeblock}
14038+
14039+
\begin{itemdecl}
14040+
template<class T, class U>
14041+
constexpr bool operator()(T&& t, U&& u) const;
1405314042
\end{itemdecl}
1405414043

1405514044
\begin{itemdescr}
14045+
\pnum
14046+
\constraints
14047+
\tcode{T} and \tcode{U} satisfy \libconcept{equality_comparable_with}.
14048+
1405614049
\pnum
1405714050
\expects
1405814051
If the expression \tcode{std::forward<T>(t) == std::forward<U>(u)}
1405914052
results in a call to a built-in operator \tcode{==} comparing pointers of type
1406014053
\tcode{P}, the conversion sequences from both \tcode{T} and \tcode{U} to \tcode{P}
14061-
are equality-preserving\iref{concepts.equality}.
14054+
are equality-preserving\iref{concepts.equality};
14055+
otherwise, \tcode{T} and \tcode{U} model \libconcept{equality_comparable_with}.
1406214056

1406314057
\pnum
1406414058
\effects
@@ -14077,61 +14071,89 @@
1407714071
\end{itemdescr}
1407814072

1407914073
\indexlibraryglobal{not_equal_to}%
14080-
\begin{itemdecl}
14074+
\begin{codeblock}
1408114075
struct ranges::not_equal_to {
1408214076
template<class T, class U>
14083-
requires @\libconcept{equality_comparable_with}@<T, U> || @\placeholdernc{BUILTIN-PTR-CMP}@(T, ==, U)
1408414077
constexpr bool operator()(T&& t, U&& u) const;
1408514078

1408614079
using is_transparent = @\unspecnc@;
1408714080
};
14081+
\end{codeblock}
14082+
14083+
\begin{itemdecl}
14084+
template<class T, class U>
14085+
constexpr bool operator()(T&& t, U&& u) const;
1408814086
\end{itemdecl}
1408914087

1409014088
\begin{itemdescr}
1409114089
\pnum
14092-
\tcode{operator()} has effects equivalent to:
14090+
\constraints
14091+
\tcode{T} and \tcode{U} satisfy \libconcept{equality_comparable_with}.
14092+
14093+
\pnum
14094+
\effects
14095+
Equivalent to:
1409314096
\begin{codeblock}
1409414097
return !ranges::equal_to{}(std::forward<T>(t), std::forward<U>(u));
1409514098
\end{codeblock}
1409614099
\end{itemdescr}
1409714100

1409814101
\indexlibraryglobal{greater}%
14099-
\begin{itemdecl}
14102+
\begin{codeblock}
1410014103
struct ranges::greater {
1410114104
template<class T, class U>
14102-
requires @\libconcept{totally_ordered_with}@<T, U> || @\placeholdernc{BUILTIN-PTR-CMP}@(U, <, T)
1410314105
constexpr bool operator()(T&& t, U&& u) const;
1410414106

1410514107
using is_transparent = @\unspecnc@;
1410614108
};
14109+
\end{codeblock}
14110+
14111+
\begin{itemdecl}
14112+
template<class T, class U>
14113+
constexpr bool operator()(T&& t, U&& u) const;
1410714114
\end{itemdecl}
1410814115

1410914116
\begin{itemdescr}
1411014117
\pnum
14111-
\tcode{operator()} has effects equivalent to:
14118+
\constraints
14119+
\tcode{T} and \tcode{U} satisfy \libconcept{totally_ordered_with}.
14120+
14121+
\pnum
14122+
\effects
14123+
Equivalent to:
1411214124
\begin{codeblock}
1411314125
return ranges::less{}(std::forward<U>(u), std::forward<T>(t));
1411414126
\end{codeblock}
1411514127
\end{itemdescr}
1411614128

1411714129
\indexlibraryglobal{less}%
14118-
\begin{itemdecl}
14130+
\begin{codeblock}
1411914131
struct ranges::less {
1412014132
template<class T, class U>
14121-
requires @\libconcept{totally_ordered_with}@<T, U> || @\placeholdernc{BUILTIN-PTR-CMP}@(T, <, U)
1412214133
constexpr bool operator()(T&& t, U&& u) const;
1412314134

1412414135
using is_transparent = @\unspecnc@;
1412514136
};
14137+
\end{codeblock}
14138+
14139+
\begin{itemdecl}
14140+
template<class T, class U>
14141+
constexpr bool operator()(T&& t, U&& u) const;
1412614142
\end{itemdecl}
1412714143

1412814144
\begin{itemdescr}
14145+
\pnum
14146+
\constraints
14147+
\tcode{T} and \tcode{U} satisfy \libconcept{totally_ordered_with}.
14148+
1412914149
\pnum
1413014150
\expects
1413114151
If the expression \tcode{std::forward<T>(t) < std::forward<U>(u)} results in a
1413214152
call to a built-in operator \tcode{<} comparing pointers of type \tcode{P}, the
1413314153
conversion sequences from both \tcode{T} and \tcode{U} to \tcode{P} are
14134-
equality-preserving\iref{concepts.equality}. For any expressions
14154+
equality-preserving\iref{concepts.equality};
14155+
otherwise, \tcode{T} and \tcode{U} model \libconcept{totally_ordered_with}.
14156+
For any expressions
1413514157
\tcode{ET} and \tcode{EU} such that \tcode{decltype((ET))} is \tcode{T} and
1413614158
\tcode{decltype((EU))} is \tcode{U}, exactly one of
1413714159
\tcode{ranges::less\{\}(ET, EU)},
@@ -14156,19 +14178,28 @@
1415614178
\end{itemdescr}
1415714179

1415814180
\indexlibraryglobal{greater_equal}%
14159-
\begin{itemdecl}
14181+
\begin{codeblock}
1416014182
struct ranges::greater_equal {
1416114183
template<class T, class U>
14162-
requires @\libconcept{totally_ordered_with}@<T, U> || @\placeholdernc{BUILTIN-PTR-CMP}@(T, <, U)
1416314184
constexpr bool operator()(T&& t, U&& u) const;
1416414185

1416514186
using is_transparent = @\unspecnc@;
1416614187
};
14188+
\end{codeblock}
14189+
14190+
\begin{itemdecl}
14191+
template<class T, class U>
14192+
constexpr bool operator()(T&& t, U&& u) const;
1416714193
\end{itemdecl}
1416814194

1416914195
\begin{itemdescr}
1417014196
\pnum
14171-
\tcode{operator()} has effects equivalent to:
14197+
\constraints
14198+
\tcode{T} and \tcode{U} satisfy \libconcept{totally_ordered_with}.
14199+
14200+
\pnum
14201+
\effects
14202+
Equivalent to:
1417214203
\begin{codeblock}
1417314204
return !ranges::less{}(std::forward<T>(t), std::forward<U>(u));
1417414205
\end{codeblock}
@@ -14178,16 +14209,25 @@
1417814209
\begin{itemdecl}
1417914210
struct ranges::less_equal {
1418014211
template<class T, class U>
14181-
requires @\libconcept{totally_ordered_with}@<T, U> || @\placeholdernc{BUILTIN-PTR-CMP}@(U, <, T)
1418214212
constexpr bool operator()(T&& t, U&& u) const;
1418314213

1418414214
using is_transparent = @\unspecnc@;
1418514215
};
1418614216
\end{itemdecl}
1418714217

14218+
\begin{itemdecl}
14219+
template<class T, class U>
14220+
constexpr bool operator()(T&& t, U&& u) const;
14221+
\end{itemdecl}
14222+
1418814223
\begin{itemdescr}
1418914224
\pnum
14190-
\tcode{operator()} has effects equivalent to:
14225+
\constraints
14226+
\tcode{T} and \tcode{U} satisfy \libconcept{totally_ordered_with}.
14227+
14228+
\pnum
14229+
\effects
14230+
Equivalent to:
1419114231
\begin{codeblock}
1419214232
return !ranges::less{}(std::forward<U>(u), std::forward<T>(t));
1419314233
\end{codeblock}

0 commit comments

Comments
 (0)