|
2582 | 2582 | namespace std::meta {
|
2583 | 2583 | using info = decltype(^^::);
|
2584 | 2584 |
|
| 2585 | + // \ref{meta.reflection.exception}, class \tcode{exception} |
| 2586 | + class exception; |
| 2587 | + |
2585 | 2588 | // \ref{meta.reflection.operators}, operator representations
|
2586 | 2589 | enum class operators {
|
2587 | 2590 | @\seebelow@;
|
|
2968 | 2971 | \end{codeblock}
|
2969 | 2972 | \end{example}
|
2970 | 2973 |
|
| 2974 | +\rSec2[meta.reflection.exception]{Class \tcode{exception}} |
| 2975 | + |
| 2976 | +\indexlibraryglobal{exception}% |
| 2977 | +\begin{itemdecl} |
| 2978 | +class exception : public std::exception |
| 2979 | +{ |
| 2980 | +private: |
| 2981 | + optional<string> @\exposid{what_}@; // \expos |
| 2982 | + u8string @\exposid{u8what_}@; // \expos |
| 2983 | + info @\exposid{from_}@; // \expos |
| 2984 | + source_location @\exposid{where_}@; // \expos |
| 2985 | + |
| 2986 | +public: |
| 2987 | + consteval exception(u8string_view what, info from, |
| 2988 | + source_location where = source_location::current()) noexcept; |
| 2989 | + |
| 2990 | + consteval exception(string_view what, info from, |
| 2991 | + source_location where = source_location::current()) noexcept; |
| 2992 | + |
| 2993 | + exception(const exception&) = default; |
| 2994 | + exception(exception&&) = default; |
| 2995 | + |
| 2996 | + exception& operator=(const exception&) = default; |
| 2997 | + exception& operator=(exception&&) = default; |
| 2998 | + |
| 2999 | + constexpr const char* what() const noexcept override; |
| 3000 | + consteval u8string_view u8what() const noexcept; |
| 3001 | + consteval info from() const noexcept; |
| 3002 | + consteval source_location where() const noexcept; |
| 3003 | +}; |
| 3004 | +\end{itemdecl} |
| 3005 | + |
| 3006 | +\begin{itemdescr} |
| 3007 | +\pnum |
| 3008 | +Reflection functions throw exceptions of type \tcode{meta::exception} |
| 3009 | +to signal an error. |
| 3010 | +\tcode{meta::exception} is a consteval-only type. |
| 3011 | +\end{itemdescr} |
| 3012 | + |
| 3013 | +\indexlibraryctor{exception}% |
| 3014 | +\begin{itemdecl} |
| 3015 | +consteval exception(u8string_view what, info from, |
| 3016 | + source_location where = source_location::current()) noexcept; |
| 3017 | +\end{itemdecl} |
| 3018 | + |
| 3019 | +\begin{itemdescr} |
| 3020 | +\pnum |
| 3021 | +\effects |
| 3022 | +Initializes |
| 3023 | +\exposid{u8what_} with \tcode{what}, |
| 3024 | +\exposid{from_} with \tcode{from}, and |
| 3025 | +\exposid{where_} with \tcode{where}. |
| 3026 | +If \tcode{what} can be represented in the ordinary literal encoding, |
| 3027 | +initializes \exposid{what_} with \tcode{what}, |
| 3028 | +transcoded from UTF-8 to the ordinary literal encoding. |
| 3029 | +Otherwhise, \exposid{what_} is value-initialized. |
| 3030 | +\end{itemdescr} |
| 3031 | + |
| 3032 | +\indexlibraryctor{exception}% |
| 3033 | +\begin{itemdecl} |
| 3034 | +consteval exception(string_view what, info from, |
| 3035 | + source_location where = source_location::current()) noexcept; |
| 3036 | +\end{itemdecl} |
| 3037 | + |
| 3038 | +\begin{itemdescr} |
| 3039 | +\pnum |
| 3040 | +\constantwhen |
| 3041 | +\tcode{what} designates a sequence of characters |
| 3042 | +that can be encoded in UTF-8. |
| 3043 | + |
| 3044 | +\pnum |
| 3045 | +\effects |
| 3046 | +Initializes |
| 3047 | +\exposid{what_} with \tcode{what}, |
| 3048 | +\exposid{u8what_} with \tcode{what} |
| 3049 | +transcoded from the ordinary literal encoding to UTF-8, |
| 3050 | +%FIXME: Oxford comma before "and" |
| 3051 | +\exposid{from_} with \tcode{from} and |
| 3052 | +\exposid{where_} with \tcode{where}. |
| 3053 | +\end{itemdescr} |
| 3054 | + |
| 3055 | +\indexlibrarymember{what}{exception}% |
| 3056 | +\begin{itemdecl} |
| 3057 | +constexpr const char* what() const noexcept override; |
| 3058 | +\end{itemdecl} |
| 3059 | + |
| 3060 | +\begin{itemdescr} |
| 3061 | +\pnum |
| 3062 | +\constantwhen |
| 3063 | +\tcode{\exposid{what_}.has_value()} is \tcode{true}. |
| 3064 | + |
| 3065 | +\pnum |
| 3066 | +\returns |
| 3067 | +\tcode{\exposid{what_}->c_str()}. |
| 3068 | +\end{itemdescr} |
| 3069 | + |
| 3070 | +\indexlibrarymember{u8what}{exception}% |
| 3071 | +\begin{itemdecl} |
| 3072 | +consteval u8string_view what() const noexcept; |
| 3073 | +\end{itemdecl} |
| 3074 | + |
| 3075 | +\begin{itemdescr} |
| 3076 | +\pnum |
| 3077 | +\returns |
| 3078 | +\exposid{u8what_}. |
| 3079 | +\end{itemdescr} |
| 3080 | + |
| 3081 | +\indexlibrarymember{from}{exception}% |
| 3082 | +\begin{itemdecl} |
| 3083 | +consteval info from() const noexcept; |
| 3084 | +\end{itemdecl} |
| 3085 | + |
| 3086 | +\begin{itemdescr} |
| 3087 | +\pnum |
| 3088 | +\returns |
| 3089 | +\exposid{from_}. |
| 3090 | +\end{itemdescr} |
| 3091 | + |
| 3092 | +\indexlibrarymember{where}{exception}% |
| 3093 | +\begin{itemdecl} |
| 3094 | +consteval source_location where() const noexcept; |
| 3095 | +\end{itemdecl} |
| 3096 | + |
| 3097 | +\begin{itemdescr} |
| 3098 | +\pnum |
| 3099 | +\returns |
| 3100 | +\exposid{where_}. |
| 3101 | +\end{itemdescr} |
| 3102 | + |
2971 | 3103 | \rSec2[meta.reflection.operators]{Operator representations}
|
2972 | 3104 |
|
2973 | 3105 | \begin{itemdecl}
|
|
0 commit comments