From Jason Turner

[class.compare.secondary]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpcg6bxfoa/{from.md → to.md} +32 -0
tmp/tmpcg6bxfoa/{from.md → to.md} RENAMED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Secondary comparison operators <a id="class.compare.secondary">[[class.compare.secondary]]</a>
2
+
3
+ A *secondary comparison operator* is a relational operator [[expr.rel]]
4
+ or the `!=` operator. A defaulted operator function [[over.binary]] for
5
+ a secondary comparison operator `@` shall have a declared return type
6
+ `bool`.
7
+
8
+ The operator function with parameters `x` and `y` is defined as deleted
9
+ if
10
+
11
+ - overload resolution [[over.match]], as applied to `x @ y`, does not
12
+ result in a usable candidate, or
13
+ - the candidate selected by overload resolution is not a rewritten
14
+ candidate.
15
+
16
+ Otherwise, the operator function yields `x @ y`. The defaulted operator
17
+ function is not considered as a candidate in the overload resolution for
18
+ the `@` operator.
19
+
20
+ [*Example 1*:
21
+
22
+ ``` cpp
23
+ struct HasNoLessThan { };
24
+
25
+ struct C {
26
+ friend HasNoLessThan operator<=>(const C&, const C&);
27
+ bool operator<(const C&) const = default; // OK, function is deleted
28
+ };
29
+ ```
30
+
31
+ — *end example*]
32
+