From Jason Turner

[expected.bad]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpduv4bjfc/{from.md → to.md} +51 -0
tmp/tmpduv4bjfc/{from.md → to.md} RENAMED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Class template `bad_expected_access` <a id="expected.bad">[[expected.bad]]</a>
2
+
3
+ ``` cpp
4
+ namespace std {
5
+ template<class E>
6
+ class bad_expected_access : public bad_expected_access<void> {
7
+ public:
8
+ explicit bad_expected_access(E);
9
+ const char* what() const noexcept override;
10
+ E& error() & noexcept;
11
+ const E& error() const & noexcept;
12
+ E&& error() && noexcept;
13
+ const E&& error() const && noexcept;
14
+
15
+ private:
16
+ E unex; // exposition only
17
+ };
18
+ }
19
+ ```
20
+
21
+ The class template `bad_expected_access` defines the type of objects
22
+ thrown as exceptions to report the situation where an attempt is made to
23
+ access the value of an `expected<T, E>` object for which `has_value()`
24
+ is `false`.
25
+
26
+ ``` cpp
27
+ explicit bad_expected_access(E e);
28
+ ```
29
+
30
+ *Effects:* Initializes *unex* with `std::move(e)`.
31
+
32
+ ``` cpp
33
+ const E& error() const & noexcept;
34
+ E& error() & noexcept;
35
+ ```
36
+
37
+ *Returns:* *unex*.
38
+
39
+ ``` cpp
40
+ E&& error() && noexcept;
41
+ const E&& error() const && noexcept;
42
+ ```
43
+
44
+ *Returns:* `std::move(`*`unex`*`)`.
45
+
46
+ ``` cpp
47
+ const char* what() const noexcept override;
48
+ ```
49
+
50
+ *Returns:* An implementation-defined NTBS.
51
+