From Jason Turner

[meta.reflection.exception]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpwcy6lqe5/{from.md → to.md} +83 -0
tmp/tmpwcy6lqe5/{from.md → to.md} RENAMED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Class `exception` <a id="meta.reflection.exception">[[meta.reflection.exception]]</a>
2
+
3
+ ``` cpp
4
+ namespace std::meta {
5
+ class exception : public std::exception {
6
+ private:
7
+ optional<string> what_; // exposition only
8
+ u8string u8what_; // exposition only
9
+ info from_; // exposition only
10
+ source_location where_; // exposition only
11
+
12
+ public:
13
+ consteval exception(u8string_view what, info from,
14
+ source_location where = source_location::current()) noexcept;
15
+
16
+ consteval exception(string_view what, info from,
17
+ source_location where = source_location::current()) noexcept;
18
+
19
+ exception(const exception&) = default;
20
+ exception(exception&&) = default;
21
+
22
+ exception& operator=(const exception&) = default;
23
+ exception& operator=(exception&&) = default;
24
+
25
+ constexpr const char* what() const noexcept override;
26
+ consteval u8string_view u8what() const noexcept;
27
+ consteval info from() const noexcept;
28
+ consteval source_location where() const noexcept;
29
+ };
30
+ }
31
+ ```
32
+
33
+ Reflection functions throw exceptions of type `meta::exception` to
34
+ signal an error. `meta::exception` is a consteval-only type.
35
+
36
+ ``` cpp
37
+ consteval exception(u8string_view what, info from,
38
+ source_location where = source_location::current()) noexcept;
39
+ ```
40
+
41
+ *Effects:* Initializes *u8what\_* with `what`, *from\_* with `from`, and
42
+ *where\_* with `where`. If `what` can be represented in the ordinary
43
+ literal encoding, initializes *what\_* with `what`, transcoded from
44
+ UTF-8 to the ordinary literal encoding. Otherwise, *what\_* is
45
+ value-initialized.
46
+
47
+ ``` cpp
48
+ consteval exception(string_view what, info from,
49
+ source_location where = source_location::current()) noexcept;
50
+ ```
51
+
52
+ `what` designates a sequence of characters that can be encoded in UTF-8.
53
+
54
+ *Effects:* Initializes *what\_* with `what`, *u8what\_* with `what`
55
+ transcoded from the ordinary literal encoding to UTF-8, *from\_* with
56
+ `from` and *where\_* with `where`.
57
+
58
+ ``` cpp
59
+ constexpr const char* what() const noexcept override;
60
+ ```
61
+
62
+ *`what_`*`.has_value()` is `true`.
63
+
64
+ *Returns:* *`what_`*`->c_str()`.
65
+
66
+ ``` cpp
67
+ consteval u8string_view u8what() const noexcept;
68
+ ```
69
+
70
+ *Returns:* *u8what\_*.
71
+
72
+ ``` cpp
73
+ consteval info from() const noexcept;
74
+ ```
75
+
76
+ *Returns:* *from\_*.
77
+
78
+ ``` cpp
79
+ consteval source_location where() const noexcept;
80
+ ```
81
+
82
+ *Returns:* *where\_*.
83
+