From Jason Turner

[comparisons.three.way]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmprso8rl7d/{from.md → to.md} +45 -0
tmp/tmprso8rl7d/{from.md → to.md} RENAMED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Class `compare_three_way` <a id="comparisons.three.way">[[comparisons.three.way]]</a>
2
+
3
+ In this subclause, `BUILTIN-PTR-THREE-WAY(T, U)` for types `T` and `U`
4
+ is a boolean constant expression. `BUILTIN-PTR-THREE-WAY(T, U)` is
5
+ `true` if and only if `<=>` in the expression
6
+
7
+ ``` cpp
8
+ declval<T>() <=> declval<U>()
9
+ ```
10
+
11
+ resolves to a built-in operator comparing pointers.
12
+
13
+ ``` cpp
14
+ struct compare_three_way {
15
+ template<class T, class U>
16
+ requires three_way_comparable_with<T, U> || BUILTIN-PTR-THREE-WAY(T, U)
17
+ constexpr auto operator()(T&& t, U&& u) const;
18
+
19
+ using is_transparent = unspecified;
20
+ };
21
+ ```
22
+
23
+ ``` cpp
24
+ template<class T, class U>
25
+ requires three_way_comparable_with<T, U> || BUILTIN-PTR-THREE-WAY(T, U)
26
+ constexpr auto operator()(T&& t, U&& u) const;
27
+ ```
28
+
29
+ *Preconditions:* If the expression
30
+ `std::forward<T>(t) <=> std::forward<U>(u)` results in a call to a
31
+ built-in operator `<=>` comparing pointers of type `P`, the conversion
32
+ sequences from both `T` and `U` to `P` are
33
+ equality-preserving [[concepts.equality]].
34
+
35
+ *Effects:*
36
+
37
+ - If the expression `std::forward<T>(t) <=> std::forward<U>(u)` results
38
+ in a call to a built-in operator `<=>` comparing pointers of type `P`,
39
+ returns `strong_ordering::less` if (the converted value of) `t`
40
+ precedes `u` in the implementation-defined strict total order over
41
+ pointers [[defns.order.ptr]], `strong_ordering::greater` if `u`
42
+ precedes `t`, and otherwise `strong_ordering::equal`.
43
+ - Otherwise, equivalent to:
44
+ `return std::forward<T>(t) <=> std::forward<U>(u);`
45
+