From Jason Turner

[expected.void.obs]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp10_mqqoc/{from.md → to.md} +66 -0
tmp/tmp10_mqqoc/{from.md → to.md} RENAMED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Observers <a id="expected.void.obs">[[expected.void.obs]]</a>
2
+
3
+ ``` cpp
4
+ constexpr explicit operator bool() const noexcept;
5
+ constexpr bool has_value() const noexcept;
6
+ ```
7
+
8
+ *Returns:* *has_val*.
9
+
10
+ ``` cpp
11
+ constexpr void operator*() const noexcept;
12
+ ```
13
+
14
+ *Preconditions:* `has_value()` is `true`.
15
+
16
+ ``` cpp
17
+ constexpr void value() const &;
18
+ ```
19
+
20
+ *Throws:* `bad_expected_access(error())` if `has_value()` is `false`.
21
+
22
+ ``` cpp
23
+ constexpr void value() &&;
24
+ ```
25
+
26
+ *Throws:* `bad_expected_access(std::move(error()))` if `has_value()` is
27
+ `false`.
28
+
29
+ ``` cpp
30
+ constexpr const E& error() const & noexcept;
31
+ constexpr E& error() & noexcept;
32
+ ```
33
+
34
+ *Preconditions:* `has_value()` is `false`.
35
+
36
+ *Returns:* *unex*.
37
+
38
+ ``` cpp
39
+ constexpr E&& error() && noexcept;
40
+ constexpr const E&& error() const && noexcept;
41
+ ```
42
+
43
+ *Preconditions:* `has_value()` is `false`.
44
+
45
+ *Returns:* `std::move(`*`unex`*`)`.
46
+
47
+ ``` cpp
48
+ template<class G = E> constexpr E error_or(G&& e) const &;
49
+ ```
50
+
51
+ *Mandates:* `is_copy_constructible_v<E>` is `true` and
52
+ `is_convertible_v<G, E>` is `true`.
53
+
54
+ *Returns:* `std::forward<G>(e)` if `has_value()` is `true`, `error()`
55
+ otherwise.
56
+
57
+ ``` cpp
58
+ template<class G = E> constexpr E error_or(G&& e) &&;
59
+ ```
60
+
61
+ *Mandates:* `is_move_constructible_v<E>` is `true` and
62
+ `is_convertible_v<G, E>` is `true`.
63
+
64
+ *Returns:* `std::forward<G>(e)` if `has_value()` is `true`,
65
+ `std::move(error())` otherwise.
66
+