From Jason Turner

[range.cmp]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpxswh8mpt/{from.md → to.md} +127 -0
tmp/tmpxswh8mpt/{from.md → to.md} RENAMED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Concept-constrained comparisons <a id="range.cmp">[[range.cmp]]</a>
2
+
3
+ In this subclause, `BUILTIN-PTR-CMP(T, op, U)` for types `T` and `U` and
4
+ where op is an equality [[expr.eq]] or relational operator [[expr.rel]]
5
+ is a boolean constant expression. `BUILTIN-PTR-CMP(T, op, U)` is `true`
6
+ if and only if op in the expression `declval<T>() op declval<U>()`
7
+ resolves to a built-in operator comparing pointers.
8
+
9
+ ``` cpp
10
+ struct ranges::equal_to {
11
+ template<class T, class U>
12
+ requires equality_comparable_with<T, U> || BUILTIN-PTR-CMP(T, ==, U)
13
+ constexpr bool operator()(T&& t, U&& u) const;
14
+
15
+ using is_transparent = unspecified;
16
+ };
17
+ ```
18
+
19
+ *Preconditions:* If the expression
20
+ `std::forward<T>(t) == std::forward<U>(u)` results in a call to a
21
+ built-in operator `==` comparing pointers of type `P`, the conversion
22
+ sequences from both `T` and `U` to `P` are
23
+ equality-preserving [[concepts.equality]].
24
+
25
+ *Effects:*
26
+
27
+ - If the expression `std::forward<T>(t) == std::forward<U>(u)` results
28
+ in a call to a built-in operator `==` comparing pointers: returns
29
+ `false` if either (the converted value of) `t` precedes `u` or `u`
30
+ precedes `t` in the implementation-defined strict total order over
31
+ pointers [[defns.order.ptr]] and otherwise `true`.
32
+ - Otherwise, equivalent to:
33
+ `return std::forward<T>(t) == std::forward<U>(u);`
34
+
35
+ ``` cpp
36
+ struct ranges::not_equal_to {
37
+ template<class T, class U>
38
+ requires equality_comparable_with<T, U> || BUILTIN-PTR-CMP(T, ==, U)
39
+ constexpr bool operator()(T&& t, U&& u) const;
40
+
41
+ using is_transparent = unspecified;
42
+ };
43
+ ```
44
+
45
+ `operator()` has effects equivalent to:
46
+
47
+ ``` cpp
48
+ return !ranges::equal_to{}(std::forward<T>(t), std::forward<U>(u));
49
+ ```
50
+
51
+ ``` cpp
52
+ struct ranges::greater {
53
+ template<class T, class U>
54
+ requires totally_ordered_with<T, U> || BUILTIN-PTR-CMP(U, <, T)
55
+ constexpr bool operator()(T&& t, U&& u) const;
56
+
57
+ using is_transparent = unspecified;
58
+ };
59
+ ```
60
+
61
+ `operator()` has effects equivalent to:
62
+
63
+ ``` cpp
64
+ return ranges::less{}(std::forward<U>(u), std::forward<T>(t));
65
+ ```
66
+
67
+ ``` cpp
68
+ struct ranges::less {
69
+ template<class T, class U>
70
+ requires totally_ordered_with<T, U> || BUILTIN-PTR-CMP(T, <, U)
71
+ constexpr bool operator()(T&& t, U&& u) const;
72
+
73
+ using is_transparent = unspecified;
74
+ };
75
+ ```
76
+
77
+ *Preconditions:* If the expression
78
+ `std::forward<T>(t) < std::forward<U>(u)` results in a call to a
79
+ built-in operator `<` comparing pointers of type `P`, the conversion
80
+ sequences from both `T` and `U` to `P` are
81
+ equality-preserving [[concepts.equality]]. For any expressions `ET` and
82
+ `EU` such that `decltype((ET))` is `T` and `decltype((EU))` is `U`,
83
+ exactly one of `ranges::less{}(ET, EU)`, `ranges::less{}(EU, ET)`, or
84
+ `ranges::equal_to{}(ET, EU)` is `true`.
85
+
86
+ *Effects:*
87
+
88
+ - If the expression `std::forward<T>(t) < std::forward<U>(u)` results in
89
+ a call to a built-in operator `<` comparing pointers: returns `true`
90
+ if (the converted value of) `t` precedes `u` in the
91
+ implementation-defined strict total order over
92
+ pointers [[defns.order.ptr]] and otherwise `false`.
93
+ - Otherwise, equivalent to:
94
+ `return std::forward<T>(t) < std::forward<U>(u);`
95
+
96
+ ``` cpp
97
+ struct ranges::greater_equal {
98
+ template<class T, class U>
99
+ requires totally_ordered_with<T, U> || BUILTIN-PTR-CMP(T, <, U)
100
+ constexpr bool operator()(T&& t, U&& u) const;
101
+
102
+ using is_transparent = unspecified;
103
+ };
104
+ ```
105
+
106
+ `operator()` has effects equivalent to:
107
+
108
+ ``` cpp
109
+ return !ranges::less{}(std::forward<T>(t), std::forward<U>(u));
110
+ ```
111
+
112
+ ``` cpp
113
+ struct ranges::less_equal {
114
+ template<class T, class U>
115
+ requires totally_ordered_with<T, U> || BUILTIN-PTR-CMP(U, <, T)
116
+ constexpr bool operator()(T&& t, U&& u) const;
117
+
118
+ using is_transparent = unspecified;
119
+ };
120
+ ```
121
+
122
+ `operator()` has effects equivalent to:
123
+
124
+ ``` cpp
125
+ return !ranges::less{}(std::forward<U>(u), std::forward<T>(t));
126
+ ```
127
+