|
2920 | 2920 | consteval bool is_string_literal(const char16_t* p); |
2921 | 2921 | consteval bool is_string_literal(const char32_t* p); |
2922 | 2922 |
|
2923 | | - // \ref{meta.define.static}, promoting to static storage strings |
| 2923 | + // \ref{meta.define.static}, promoting to static storage |
| 2924 | + namespace meta { |
| 2925 | + template<ranges::@\libconcept{input_range}@ R> |
| 2926 | + consteval info reflect_constant_string(R&& r); |
| 2927 | + template<ranges::@\libconcept{input_range}@ R> |
| 2928 | + consteval info reflect_constant_array(R&& r); |
| 2929 | + } |
2924 | 2930 | template<ranges::@\libconcept{input_range}@ R> |
2925 | 2931 | consteval const ranges::range_value_t<R>* define_static_string(R&& r); |
2926 | 2932 | template<ranges::@\libconcept{input_range}@ R> |
|
3105 | 3111 | template<class T> |
3106 | 3112 | consteval info reflect_function(T& fn); |
3107 | 3113 |
|
3108 | | - // \ref{meta.reflection.array}, promoting to static storage arrays |
3109 | | - template<ranges::@\libconcept{input_range}@ R> |
3110 | | - consteval info reflect_constant_string(R&& r); |
3111 | | - |
3112 | | - template<ranges::@\libconcept{input_range}@ R> |
3113 | | - consteval info reflect_constant_array(R&& r); |
3114 | | - |
3115 | 3114 | // \ref{meta.reflection.define.aggregate}, class definition generation |
3116 | 3115 | struct data_member_options; |
3117 | 3116 | consteval info data_member_spec(info type, data_member_options options); |
|
3374 | 3373 | \end{itemize} |
3375 | 3374 | \end{itemdescr} |
3376 | 3375 |
|
3377 | | -\rSec2[meta.define.static]{Promoting to static storage strings} |
| 3376 | +\rSec2[meta.define.static]{Promoting to static storage} |
3378 | 3377 |
|
3379 | 3378 | \pnum |
3380 | 3379 | The functions in this subclause promote compile-time storage into static storage. |
3381 | 3380 |
|
| 3381 | +\indexlibraryglobal{reflect_constant_string}% |
| 3382 | +\begin{itemdecl} |
| 3383 | +template<ranges::@\libconcept{input_range}@ R> |
| 3384 | + consteval info reflect_constant_string(R&& r); |
| 3385 | +\end{itemdecl} |
| 3386 | + |
| 3387 | +\begin{itemdescr} |
| 3388 | +\pnum |
| 3389 | +Let \tcode{CharT} be \tcode{ranges::range_value_t<R>}. |
| 3390 | + |
| 3391 | +\pnum |
| 3392 | +\mandates |
| 3393 | +\tcode{CharT} is one of |
| 3394 | +\tcode{char}, |
| 3395 | +\tcode{wchar_t}, |
| 3396 | +\tcode{char8_t}, |
| 3397 | +\tcode{char16_t}, |
| 3398 | +\tcode{char32_t}. |
| 3399 | + |
| 3400 | +\pnum |
| 3401 | +Let $V$ be the pack of values of type \tcode{CharT} |
| 3402 | +whose elements are the corresponding elements of \tcode{r}, |
| 3403 | +except that if \tcode{r} refers to a string literal object, |
| 3404 | +then $V$ does not include the trailing null terminator of \tcode{r}. |
| 3405 | + |
| 3406 | +\pnum |
| 3407 | +Let $P$ be the template parameter object\iref{temp.param} |
| 3408 | +of type \tcode{const CharT[sizeof...(V) + 1]} |
| 3409 | +initialized with \tcode{\{$V$..., CharT()\}}. |
| 3410 | + |
| 3411 | +\pnum |
| 3412 | +\returns |
| 3413 | +\tcode{\reflexpr{$P$}}. |
| 3414 | + |
| 3415 | +\pnum |
| 3416 | +\begin{note} |
| 3417 | +$P$ is a potentially non-unique object\iref{intro.object}. |
| 3418 | +\end{note} |
| 3419 | +\end{itemdescr} |
| 3420 | + |
| 3421 | +\indexlibraryglobal{reflect_constant_array}% |
| 3422 | +\begin{itemdecl} |
| 3423 | +template<ranges::@\libconcept{input_range}@ R> |
| 3424 | + consteval info reflect_constant_array(R&& r); |
| 3425 | +\end{itemdecl} |
| 3426 | + |
| 3427 | +\begin{itemdescr} |
| 3428 | +\pnum |
| 3429 | +Let \tcode{T} be \tcode{ranges::range_value_t<R>}. |
| 3430 | + |
| 3431 | +\pnum |
| 3432 | +\mandates |
| 3433 | +\tcode{T} is a structural type\iref{temp.param}, |
| 3434 | +\tcode{is_constructible_v<T, ranges::range_reference_t<R>>} is \tcode{true}, and |
| 3435 | +\tcode{is_copy_constructible_v<T>} is \tcode{true}. |
| 3436 | + |
| 3437 | +\pnum |
| 3438 | +Let $V$ be the pack of values of type \tcode{info} |
| 3439 | +of the same size as \tcode{r}, |
| 3440 | +where the $i^\text{th}$ element is \tcode{reflect_constant($\tcode{e}_i$)}, |
| 3441 | +where $\tcode{e}_i$ is the $i^\text{th}$ element of \tcode{r}. |
| 3442 | + |
| 3443 | +\pnum |
| 3444 | +Let $P$ be |
| 3445 | +\begin{itemize} |
| 3446 | +\item |
| 3447 | + If \tcode{sizeof...($V$) > 0} is \tcode{true}, |
| 3448 | + then the template parameter object\iref{temp.param} |
| 3449 | + of type \tcode{const T[\brk{}sizeof...(\brk{}$V$)]} |
| 3450 | + initialized with \tcode{\{[:$V$:]...\}}. |
| 3451 | +\item |
| 3452 | + Otherwise, the template parameter object |
| 3453 | + of type \tcode{const array<T, 0>} |
| 3454 | + initialized with \tcode{\{\}}. |
| 3455 | +\end{itemize} |
| 3456 | + |
| 3457 | +\pnum |
| 3458 | +\returns |
| 3459 | +\tcode{\reflexpr{$P$}}. |
| 3460 | + |
| 3461 | +\pnum |
| 3462 | +\throws |
| 3463 | +\tcode{meta::exception} unless |
| 3464 | +\tcode{reflect_constant(e)} is a constant subexpression |
| 3465 | +for every element \tcode{e} of \tcode{r}. |
| 3466 | + |
| 3467 | +\pnum |
| 3468 | +\begin{note} |
| 3469 | +$P$ is a potentially non-unique object\iref{intro.object}. |
| 3470 | +\end{note} |
| 3471 | +\end{itemdescr} |
| 3472 | + |
3382 | 3473 | \indexlibraryglobal{define_static_string}% |
3383 | 3474 | \begin{itemdecl} |
3384 | 3475 | template<ranges::@\libconcept{input_range}@ R> |
|
6209 | 6300 | for a constant template parameter of type \tcode{T\&}\iref{temp.arg.nontype}. |
6210 | 6301 | \end{itemdescr} |
6211 | 6302 |
|
6212 | | -\rSec2[meta.reflection.array]{Promoting to static storage arrays} |
6213 | | - |
6214 | | -\pnum |
6215 | | -The functions in this subclause promote compile-time storage into static storage. |
6216 | | - |
6217 | | -\indexlibraryglobal{reflect_constant_string}% |
6218 | | -\begin{itemdecl} |
6219 | | -template<ranges::@\libconcept{input_range}@ R> |
6220 | | - consteval info reflect_constant_string(R&& r); |
6221 | | -\end{itemdecl} |
6222 | | - |
6223 | | -\begin{itemdescr} |
6224 | | -\pnum |
6225 | | -Let \tcode{CharT} be \tcode{ranges::range_value_t<R>}. |
6226 | | - |
6227 | | -\pnum |
6228 | | -\mandates |
6229 | | -\tcode{CharT} is one of |
6230 | | -\tcode{char}, |
6231 | | -\tcode{wchar_t}, |
6232 | | -\tcode{char8_t}, |
6233 | | -\tcode{char16_t}, |
6234 | | -\tcode{char32_t}. |
6235 | | - |
6236 | | -\pnum |
6237 | | -Let $V$ be the pack of values of type \tcode{CharT} |
6238 | | -whose elements are the corresponding elements of \tcode{r}, |
6239 | | -except that if \tcode{r} refers to a string literal object, |
6240 | | -then $V$ does not include the trailing null terminator of \tcode{r}. |
6241 | | - |
6242 | | -\pnum |
6243 | | -Let $P$ be the template parameter object\iref{temp.param} |
6244 | | -of type \tcode{const CharT[sizeof...(V) + 1]} |
6245 | | -initialized with \tcode{\{$V$..., CharT()\}}. |
6246 | | - |
6247 | | -\pnum |
6248 | | -\returns |
6249 | | -\tcode{\reflexpr{$P$}}. |
6250 | | - |
6251 | | -\pnum |
6252 | | -\begin{note} |
6253 | | -$P$ is a potentially non-unique object\iref{intro.object}. |
6254 | | -\end{note} |
6255 | | -\end{itemdescr} |
6256 | | - |
6257 | | -\indexlibraryglobal{reflect_constant_array}% |
6258 | | -\begin{itemdecl} |
6259 | | -template<ranges::@\libconcept{input_range}@ R> |
6260 | | - consteval info reflect_constant_array(R&& r); |
6261 | | -\end{itemdecl} |
6262 | | - |
6263 | | -\begin{itemdescr} |
6264 | | -\pnum |
6265 | | -Let \tcode{T} be \tcode{ranges::range_value_t<R>}. |
6266 | | - |
6267 | | -\pnum |
6268 | | -\mandates |
6269 | | -\tcode{T} is a structural type\iref{temp.param}, |
6270 | | -\tcode{is_constructible_v<T, ranges::range_reference_t<R>>} is \tcode{true}, and |
6271 | | -\tcode{is_copy_constructible_v<T>} is \tcode{true}. |
6272 | | - |
6273 | | -\pnum |
6274 | | -Let $V$ be the pack of values of type \tcode{info} |
6275 | | -of the same size as \tcode{r}, |
6276 | | -where the $i^\text{th}$ element is \tcode{reflect_constant($\tcode{e}_i$)}, |
6277 | | -where $\tcode{e}_i$ is the $i^\text{th}$ element of \tcode{r}. |
6278 | | - |
6279 | | -\pnum |
6280 | | -Let $P$ be |
6281 | | -\begin{itemize} |
6282 | | -\item |
6283 | | - If \tcode{sizeof...($V$) > 0} is \tcode{true}, |
6284 | | - then the template parameter object\iref{temp.param} |
6285 | | - of type \tcode{const T[\brk{}sizeof...(\brk{}$V$)]} |
6286 | | - initialized with \tcode{\{[:$V$:]...\}}. |
6287 | | -\item |
6288 | | - Otherwise, the template parameter object |
6289 | | - of type \tcode{const array<T, 0>} |
6290 | | - initialized with \tcode{\{\}}. |
6291 | | -\end{itemize} |
6292 | | - |
6293 | | -\pnum |
6294 | | -\returns |
6295 | | -\tcode{\reflexpr{$P$}}. |
6296 | | - |
6297 | | -\pnum |
6298 | | -\throws |
6299 | | -\tcode{meta::exception} unless |
6300 | | -\tcode{reflect_constant(e)} is a constant subexpression |
6301 | | -for every element \tcode{e} of \tcode{r}. |
6302 | | - |
6303 | | -\pnum |
6304 | | -\begin{note} |
6305 | | -$P$ is a potentially non-unique object\iref{intro.object}. |
6306 | | -\end{note} |
6307 | | -\end{itemdescr} |
6308 | | - |
6309 | 6303 | \rSec2[meta.reflection.define.aggregate]{Reflection class definition generation} |
6310 | 6304 |
|
6311 | 6305 | \indexlibraryglobal{data_member_options}% |
|
0 commit comments