From Jason Turner

[cmp.weakord]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpep92ah0k/{from.md → to.md} +91 -0
tmp/tmpep92ah0k/{from.md → to.md} RENAMED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Class `weak_ordering` <a id="cmp.weakord">[[cmp.weakord]]</a>
2
+
3
+ The `weak_ordering` type is typically used as the result type of a
4
+ three-way comparison operator [[expr.spaceship]] that (a) admits all of
5
+ the six two-way comparison operators ([[expr.rel]], [[expr.eq]]), and
6
+ (b) does not imply substitutability.
7
+
8
+ ``` cpp
9
+ namespace std {
10
+ class weak_ordering {
11
+ int value; // exposition only
12
+
13
+ // exposition-only constructors
14
+ constexpr explicit weak_ordering(eq v) noexcept : value(int(v)) {} // exposition only
15
+ constexpr explicit weak_ordering(ord v) noexcept : value(int(v)) {} // exposition only
16
+
17
+ public:
18
+ // valid values
19
+ static const weak_ordering less;
20
+ static const weak_ordering equivalent;
21
+ static const weak_ordering greater;
22
+
23
+ // conversions
24
+ constexpr operator partial_ordering() const noexcept;
25
+
26
+ // comparisons
27
+ friend constexpr bool operator==(weak_ordering v, unspecified) noexcept;
28
+ friend constexpr bool operator==(weak_ordering v, weak_ordering w) noexcept = default;
29
+ friend constexpr bool operator< (weak_ordering v, unspecified) noexcept;
30
+ friend constexpr bool operator> (weak_ordering v, unspecified) noexcept;
31
+ friend constexpr bool operator<=(weak_ordering v, unspecified) noexcept;
32
+ friend constexpr bool operator>=(weak_ordering v, unspecified) noexcept;
33
+ friend constexpr bool operator< (unspecified, weak_ordering v) noexcept;
34
+ friend constexpr bool operator> (unspecified, weak_ordering v) noexcept;
35
+ friend constexpr bool operator<=(unspecified, weak_ordering v) noexcept;
36
+ friend constexpr bool operator>=(unspecified, weak_ordering v) noexcept;
37
+ friend constexpr weak_ordering operator<=>(weak_ordering v, unspecified) noexcept;
38
+ friend constexpr weak_ordering operator<=>(unspecified, weak_ordering v) noexcept;
39
+ };
40
+
41
+ // valid values' definitions
42
+ inline constexpr weak_ordering weak_ordering::less(ord::less);
43
+ inline constexpr weak_ordering weak_ordering::equivalent(eq::equivalent);
44
+ inline constexpr weak_ordering weak_ordering::greater(ord::greater);
45
+ }
46
+ ```
47
+
48
+ ``` cpp
49
+ constexpr operator partial_ordering() const noexcept;
50
+ ```
51
+
52
+ *Returns:*
53
+
54
+ ``` cpp
55
+ value == 0 ? partial_ordering::equivalent :
56
+ value < 0 ? partial_ordering::less :
57
+ partial_ordering::greater
58
+ ```
59
+
60
+ ``` cpp
61
+ constexpr bool operator==(weak_ordering v, unspecified) noexcept;
62
+ constexpr bool operator< (weak_ordering v, unspecified) noexcept;
63
+ constexpr bool operator> (weak_ordering v, unspecified) noexcept;
64
+ constexpr bool operator<=(weak_ordering v, unspecified) noexcept;
65
+ constexpr bool operator>=(weak_ordering v, unspecified) noexcept;
66
+ ```
67
+
68
+ *Returns:* `v.value 0` for `operator`.
69
+
70
+ ``` cpp
71
+ constexpr bool operator< (unspecified, weak_ordering v) noexcept;
72
+ constexpr bool operator> (unspecified, weak_ordering v) noexcept;
73
+ constexpr bool operator<=(unspecified, weak_ordering v) noexcept;
74
+ constexpr bool operator>=(unspecified, weak_ordering v) noexcept;
75
+ ```
76
+
77
+ *Returns:* `0 v.value` for `operator`.
78
+
79
+ ``` cpp
80
+ constexpr weak_ordering operator<=>(weak_ordering v, unspecified) noexcept;
81
+ ```
82
+
83
+ *Returns:* `v`.
84
+
85
+ ``` cpp
86
+ constexpr weak_ordering operator<=>(unspecified, weak_ordering v) noexcept;
87
+ ```
88
+
89
+ *Returns:*
90
+ `v < 0 ? weak_ordering::greater : v > 0 ? weak_ordering::less : v`.
91
+