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