From Jason Turner

[cmp.alg]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpdrzrs_17/{from.md → to.md} +48 -26
tmp/tmpdrzrs_17/{from.md → to.md} RENAMED
@@ -1,38 +1,41 @@
1
  ### Comparison algorithms <a id="cmp.alg">[[cmp.alg]]</a>
2
 
3
  The name `strong_order` denotes a customization point object
4
  [[customization.point.object]]. Given subexpressions `E` and `F`, the
5
  expression `strong_order(E, F)` is expression-equivalent
6
- [[defns.expression-equivalent]] to the following:
7
 
8
  - If the decayed types of `E` and `F` differ, `strong_order(E, F)` is
9
  ill-formed.
10
  - Otherwise, `strong_ordering(strong_order(E, F))` if it is a
11
- well-formed expression with overload resolution performed in a context
12
- that does not include a declaration of `std::strong_order`.
 
13
  - Otherwise, if the decayed type `T` of `E` is a floating-point type,
14
  yields a value of type `strong_ordering` that is consistent with the
15
  ordering observed by `T`’s comparison operators, and if
16
  `numeric_limits<T>::is_iec559` is `true`, is additionally consistent
17
  with the `totalOrder` operation as specified in ISO/IEC/IEEE 60559.
18
  - Otherwise, `strong_ordering(compare_three_way()(E, F))` if it is a
19
  well-formed expression.
20
- - Otherwise, `strong_order(E, F)` is ill-formed. \[*Note 1*: This case
21
- can result in substitution failure when `strong_order(E, F)` appears
22
- in the immediate context of a template instantiation. *end note*]
 
 
23
 
24
  The name `weak_order` denotes a customization point object
25
  [[customization.point.object]]. Given subexpressions `E` and `F`, the
26
  expression `weak_order(E, F)` is expression-equivalent
27
- [[defns.expression-equivalent]] to the following:
28
 
29
  - If the decayed types of `E` and `F` differ, `weak_order(E, F)` is
30
  ill-formed.
31
  - Otherwise, `weak_ordering(weak_order(E, F))` if it is a well-formed
32
- expression with overload resolution performed in a context that does
33
- not include a declaration of `std::weak_order`.
34
  - Otherwise, if the decayed type `T` of `E` is a floating-point type,
35
  yields a value of type `weak_ordering` that is consistent with the
36
  ordering observed by `T`’s comparison operators and `strong_order`,
37
  and if `numeric_limits<T>::is_iec559` is `true`, is additionally
38
  consistent with the following equivalence classes, ordered from lesser
@@ -48,86 +51,105 @@ expression `weak_order(E, F)` is expression-equivalent
48
  - together, all positive NaN values.
49
  - Otherwise, `weak_ordering(compare_three_way()(E, F))` if it is a
50
  well-formed expression.
51
  - Otherwise, `weak_ordering(strong_order(E, F))` if it is a well-formed
52
  expression.
53
- - Otherwise, `weak_order(E, F)` is ill-formed. \[*Note 2*: This case can
54
- result in substitution failure when `std::weak_order(E, F)` appears in
55
- the immediate context of a template instantiation. *end note*]
 
 
56
 
57
  The name `partial_order` denotes a customization point object
58
  [[customization.point.object]]. Given subexpressions `E` and `F`, the
59
  expression `partial_order(E, F)` is expression-equivalent
60
- [[defns.expression-equivalent]] to the following:
61
 
62
  - If the decayed types of `E` and `F` differ, `partial_order(E, F)` is
63
  ill-formed.
64
  - Otherwise, `partial_ordering(partial_order(E, F))` if it is a
65
- well-formed expression with overload resolution performed in a context
66
- that does not include a declaration of `std::partial_order`.
 
67
  - Otherwise, `partial_ordering(compare_three_way()(E, F))` if it is a
68
  well-formed expression.
69
  - Otherwise, `partial_ordering(weak_order(E, F))` if it is a well-formed
70
  expression.
71
- - Otherwise, `partial_order(E, F)` is ill-formed. \[*Note 3*: This case
72
- can result in substitution failure when `std::partial_order(E, F)`
73
- appears in the immediate context of a template
 
74
  instantiation. — *end note*]
75
 
76
  The name `compare_strong_order_fallback` denotes a customization point
77
- object [[customization.point.object]]. Given subexpressions `E` and F,
78
  the expression `compare_strong_order_fallback(E, F)` is
79
- expression-equivalent [[defns.expression-equivalent]] to:
80
 
81
  - If the decayed types of `E` and `F` differ,
82
  `compare_strong_order_fallback(E, F)` is ill-formed.
83
  - Otherwise, `strong_order(E, F)` if it is a well-formed expression.
84
  - Otherwise, if the expressions `E == F` and `E < F` are both
85
- well-formed and convertible to `bool`,
 
86
  ``` cpp
87
  E == F ? strong_ordering::equal :
88
  E < F ? strong_ordering::less :
89
  strong_ordering::greater
90
  ```
91
 
92
  except that `E` and `F` are evaluated only once.
93
  - Otherwise, `compare_strong_order_fallback(E, F)` is ill-formed.
94
 
 
 
 
 
95
  The name `compare_weak_order_fallback` denotes a customization point
96
  object [[customization.point.object]]. Given subexpressions `E` and `F`,
97
  the expression `compare_weak_order_fallback(E, F)` is
98
- expression-equivalent [[defns.expression-equivalent]] to:
99
 
100
  - If the decayed types of `E` and `F` differ,
101
  `compare_weak_order_fallback(E, F)` is ill-formed.
102
  - Otherwise, `weak_order(E, F)` if it is a well-formed expression.
103
  - Otherwise, if the expressions `E == F` and `E < F` are both
104
- well-formed and convertible to `bool`,
 
105
  ``` cpp
106
  E == F ? weak_ordering::equivalent :
107
  E < F ? weak_ordering::less :
108
  weak_ordering::greater
109
  ```
110
 
111
  except that `E` and `F` are evaluated only once.
112
  - Otherwise, `compare_weak_order_fallback(E, F)` is ill-formed.
113
 
 
 
 
 
114
  The name `compare_partial_order_fallback` denotes a customization point
115
  object [[customization.point.object]]. Given subexpressions `E` and `F`,
116
  the expression `compare_partial_order_fallback(E, F)` is
117
- expression-equivalent [[defns.expression-equivalent]] to:
118
 
119
  - If the decayed types of `E` and `F` differ,
120
  `compare_partial_order_fallback(E, F)` is ill-formed.
121
  - Otherwise, `partial_order(E, F)` if it is a well-formed expression.
122
- - Otherwise, if the expressions `E == F` and `E < F` are both
123
- well-formed and convertible to `bool`,
 
124
  ``` cpp
125
  E == F ? partial_ordering::equivalent :
126
  E < F ? partial_ordering::less :
127
  F < E ? partial_ordering::greater :
128
  partial_ordering::unordered
129
  ```
130
 
131
  except that `E` and `F` are evaluated only once.
132
  - Otherwise, `compare_partial_order_fallback(E, F)` is ill-formed.
133
 
 
 
 
 
 
1
  ### Comparison algorithms <a id="cmp.alg">[[cmp.alg]]</a>
2
 
3
  The name `strong_order` denotes a customization point object
4
  [[customization.point.object]]. Given subexpressions `E` and `F`, the
5
  expression `strong_order(E, F)` is expression-equivalent
6
+ [[defns.expression.equivalent]] to the following:
7
 
8
  - If the decayed types of `E` and `F` differ, `strong_order(E, F)` is
9
  ill-formed.
10
  - Otherwise, `strong_ordering(strong_order(E, F))` if it is a
11
+ well-formed expression where the meaning of `strong_order` is
12
+ established as-if by performing argument-dependent lookup only
13
+ [[basic.lookup.argdep]].
14
  - Otherwise, if the decayed type `T` of `E` is a floating-point type,
15
  yields a value of type `strong_ordering` that is consistent with the
16
  ordering observed by `T`’s comparison operators, and if
17
  `numeric_limits<T>::is_iec559` is `true`, is additionally consistent
18
  with the `totalOrder` operation as specified in ISO/IEC/IEEE 60559.
19
  - Otherwise, `strong_ordering(compare_three_way()(E, F))` if it is a
20
  well-formed expression.
21
+ - Otherwise, `strong_order(E, F)` is ill-formed.
22
+
23
+ [*Note 1*: Ill-formed cases above result in substitution failure when
24
+ `strong_order(E, F)` appears in the immediate context of a template
25
+ instantiation. — *end note*]
26
 
27
  The name `weak_order` denotes a customization point object
28
  [[customization.point.object]]. Given subexpressions `E` and `F`, the
29
  expression `weak_order(E, F)` is expression-equivalent
30
+ [[defns.expression.equivalent]] to the following:
31
 
32
  - If the decayed types of `E` and `F` differ, `weak_order(E, F)` is
33
  ill-formed.
34
  - Otherwise, `weak_ordering(weak_order(E, F))` if it is a well-formed
35
+ expression where the meaning of `weak_order` is established as-if by
36
+ performing argument-dependent lookup only [[basic.lookup.argdep]].
37
  - Otherwise, if the decayed type `T` of `E` is a floating-point type,
38
  yields a value of type `weak_ordering` that is consistent with the
39
  ordering observed by `T`’s comparison operators and `strong_order`,
40
  and if `numeric_limits<T>::is_iec559` is `true`, is additionally
41
  consistent with the following equivalence classes, ordered from lesser
 
51
  - together, all positive NaN values.
52
  - Otherwise, `weak_ordering(compare_three_way()(E, F))` if it is a
53
  well-formed expression.
54
  - Otherwise, `weak_ordering(strong_order(E, F))` if it is a well-formed
55
  expression.
56
+ - Otherwise, `weak_order(E, F)` is ill-formed.
57
+
58
+ [*Note 2*: Ill-formed cases above result in substitution failure when
59
+ `weak_order(E, F)` appears in the immediate context of a template
60
+ instantiation. — *end note*]
61
 
62
  The name `partial_order` denotes a customization point object
63
  [[customization.point.object]]. Given subexpressions `E` and `F`, the
64
  expression `partial_order(E, F)` is expression-equivalent
65
+ [[defns.expression.equivalent]] to the following:
66
 
67
  - If the decayed types of `E` and `F` differ, `partial_order(E, F)` is
68
  ill-formed.
69
  - Otherwise, `partial_ordering(partial_order(E, F))` if it is a
70
+ well-formed expression where the meaning of `partial_order` is
71
+ established as-if by performing argument-dependent lookup only
72
+ [[basic.lookup.argdep]].
73
  - Otherwise, `partial_ordering(compare_three_way()(E, F))` if it is a
74
  well-formed expression.
75
  - Otherwise, `partial_ordering(weak_order(E, F))` if it is a well-formed
76
  expression.
77
+ - Otherwise, `partial_order(E, F)` is ill-formed.
78
+
79
+ [*Note 3*: Ill-formed cases above result in substitution failure when
80
+ `partial_order(E, F)` appears in the immediate context of a template
81
  instantiation. — *end note*]
82
 
83
  The name `compare_strong_order_fallback` denotes a customization point
84
+ object [[customization.point.object]]. Given subexpressions `E` and `F`,
85
  the expression `compare_strong_order_fallback(E, F)` is
86
+ expression-equivalent [[defns.expression.equivalent]] to:
87
 
88
  - If the decayed types of `E` and `F` differ,
89
  `compare_strong_order_fallback(E, F)` is ill-formed.
90
  - Otherwise, `strong_order(E, F)` if it is a well-formed expression.
91
  - Otherwise, if the expressions `E == F` and `E < F` are both
92
+ well-formed and each of `decltype(E == F)` and `decltype(E < F)`
93
+ models `boolean-testable`,
94
  ``` cpp
95
  E == F ? strong_ordering::equal :
96
  E < F ? strong_ordering::less :
97
  strong_ordering::greater
98
  ```
99
 
100
  except that `E` and `F` are evaluated only once.
101
  - Otherwise, `compare_strong_order_fallback(E, F)` is ill-formed.
102
 
103
+ [*Note 4*: Ill-formed cases above result in substitution failure when
104
+ `compare_strong_order_fallback(E, F)` appears in the immediate context
105
+ of a template instantiation. — *end note*]
106
+
107
  The name `compare_weak_order_fallback` denotes a customization point
108
  object [[customization.point.object]]. Given subexpressions `E` and `F`,
109
  the expression `compare_weak_order_fallback(E, F)` is
110
+ expression-equivalent [[defns.expression.equivalent]] to:
111
 
112
  - If the decayed types of `E` and `F` differ,
113
  `compare_weak_order_fallback(E, F)` is ill-formed.
114
  - Otherwise, `weak_order(E, F)` if it is a well-formed expression.
115
  - Otherwise, if the expressions `E == F` and `E < F` are both
116
+ well-formed and each of `decltype(E == F)` and `decltype(E < F)`
117
+ models `boolean-testable`,
118
  ``` cpp
119
  E == F ? weak_ordering::equivalent :
120
  E < F ? weak_ordering::less :
121
  weak_ordering::greater
122
  ```
123
 
124
  except that `E` and `F` are evaluated only once.
125
  - Otherwise, `compare_weak_order_fallback(E, F)` is ill-formed.
126
 
127
+ [*Note 5*: Ill-formed cases above result in substitution failure when
128
+ `compare_weak_order_fallback(E, F)` appears in the immediate context of
129
+ a template instantiation. — *end note*]
130
+
131
  The name `compare_partial_order_fallback` denotes a customization point
132
  object [[customization.point.object]]. Given subexpressions `E` and `F`,
133
  the expression `compare_partial_order_fallback(E, F)` is
134
+ expression-equivalent [[defns.expression.equivalent]] to:
135
 
136
  - If the decayed types of `E` and `F` differ,
137
  `compare_partial_order_fallback(E, F)` is ill-formed.
138
  - Otherwise, `partial_order(E, F)` if it is a well-formed expression.
139
+ - Otherwise, if the expressions `E == F`, `E < F`, and `F < E` are all
140
+ well-formed and each of `decltype(E == F)` and `decltype(E < F)`
141
+ models `boolean-testable`,
142
  ``` cpp
143
  E == F ? partial_ordering::equivalent :
144
  E < F ? partial_ordering::less :
145
  F < E ? partial_ordering::greater :
146
  partial_ordering::unordered
147
  ```
148
 
149
  except that `E` and `F` are evaluated only once.
150
  - Otherwise, `compare_partial_order_fallback(E, F)` is ill-formed.
151
 
152
+ [*Note 6*: Ill-formed cases above result in substitution failure when
153
+ `compare_partial_order_fallback(E, F)` appears in the immediate context
154
+ of a template instantiation. — *end note*]
155
+