From Jason Turner

[expected.object.eq]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpzmanxiq2/{from.md → to.md} +35 -0
tmp/tmpzmanxiq2/{from.md → to.md} RENAMED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Equality operators <a id="expected.object.eq">[[expected.object.eq]]</a>
2
+
3
+ ``` cpp
4
+ template<class T2, class E2> requires (!is_void_v<T2>)
5
+ friend constexpr bool operator==(const expected& x, const expected<T2, E2>& y);
6
+ ```
7
+
8
+ *Mandates:* The expressions `*x == *y` and `x.error() == y.error()` are
9
+ well-formed and their results are convertible to `bool`.
10
+
11
+ *Returns:* If `x.has_value()` does not equal `y.has_value()`, `false`;
12
+ otherwise if `x.has_value()` is `true`, `*x == *y`; otherwise
13
+ `x.error() == y.error()`.
14
+
15
+ ``` cpp
16
+ template<class T2> friend constexpr bool operator==(const expected& x, const T2& v);
17
+ ```
18
+
19
+ *Mandates:* The expression `*x == v` is well-formed and its result is
20
+ convertible to `bool`.
21
+
22
+ [*Note 1*: `T` need not be *Cpp17EqualityComparable*. — *end note*]
23
+
24
+ *Returns:* `x.has_value() && static_cast<bool>(*x == v)`.
25
+
26
+ ``` cpp
27
+ template<class E2> friend constexpr bool operator==(const expected& x, const unexpected<E2>& e);
28
+ ```
29
+
30
+ *Mandates:* The expression `x.error() == e.error()` is well-formed and
31
+ its result is convertible to `bool`.
32
+
33
+ *Returns:*
34
+ `!x.has_value() && static_cast<bool>(x.error() == e.error())`.
35
+