|
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> |
|
3109 | 3115 | template<class T> |
3110 | 3116 | consteval info reflect_function(T& fn); |
3111 | 3117 |
|
3112 | | - // \ref{meta.reflection.array}, promoting to static storage arrays |
3113 | | - template<ranges::@\libconcept{input_range}@ R> |
3114 | | - consteval info reflect_constant_string(R&& r); |
3115 | | - |
3116 | | - template<ranges::@\libconcept{input_range}@ R> |
3117 | | - consteval info reflect_constant_array(R&& r); |
3118 | | - |
3119 | 3118 | // \ref{meta.reflection.define.aggregate}, class definition generation |
3120 | 3119 | struct data_member_options; |
3121 | 3120 | 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> |
|
6319 | 6410 | for a constant template parameter of type \tcode{T\&}\iref{temp.arg.nontype}. |
6320 | 6411 | \end{itemdescr} |
6321 | 6412 |
|
6322 | | -\rSec2[meta.reflection.array]{Promoting to static storage arrays} |
6323 | | - |
6324 | | -\pnum |
6325 | | -The functions in this subclause promote compile-time storage into static storage. |
6326 | | - |
6327 | | -\indexlibraryglobal{reflect_constant_string}% |
6328 | | -\begin{itemdecl} |
6329 | | -template<ranges::@\libconcept{input_range}@ R> |
6330 | | - consteval info reflect_constant_string(R&& r); |
6331 | | -\end{itemdecl} |
6332 | | - |
6333 | | -\begin{itemdescr} |
6334 | | -\pnum |
6335 | | -Let \tcode{CharT} be \tcode{ranges::range_value_t<R>}. |
6336 | | - |
6337 | | -\pnum |
6338 | | -\mandates |
6339 | | -\tcode{CharT} is one of |
6340 | | -\tcode{char}, |
6341 | | -\tcode{wchar_t}, |
6342 | | -\tcode{char8_t}, |
6343 | | -\tcode{char16_t}, |
6344 | | -\tcode{char32_t}. |
6345 | | - |
6346 | | -\pnum |
6347 | | -Let $V$ be the pack of values of type \tcode{CharT} |
6348 | | -whose elements are the corresponding elements of \tcode{r}, |
6349 | | -except that if \tcode{r} refers to a string literal object, |
6350 | | -then $V$ does not include the trailing null terminator of \tcode{r}. |
6351 | | - |
6352 | | -\pnum |
6353 | | -Let $P$ be the template parameter object\iref{temp.param} |
6354 | | -of type \tcode{const CharT[sizeof...(V) + 1]} |
6355 | | -initialized with \tcode{\{$V$..., CharT()\}}. |
6356 | | - |
6357 | | -\pnum |
6358 | | -\returns |
6359 | | -\tcode{\reflexpr{$P$}}. |
6360 | | - |
6361 | | -\pnum |
6362 | | -\begin{note} |
6363 | | -$P$ is a potentially non-unique object\iref{intro.object}. |
6364 | | -\end{note} |
6365 | | -\end{itemdescr} |
6366 | | - |
6367 | | -\indexlibraryglobal{reflect_constant_array}% |
6368 | | -\begin{itemdecl} |
6369 | | -template<ranges::@\libconcept{input_range}@ R> |
6370 | | - consteval info reflect_constant_array(R&& r); |
6371 | | -\end{itemdecl} |
6372 | | - |
6373 | | -\begin{itemdescr} |
6374 | | -\pnum |
6375 | | -Let \tcode{T} be \tcode{ranges::range_value_t<R>}. |
6376 | | - |
6377 | | -\pnum |
6378 | | -\mandates |
6379 | | -\tcode{T} is a structural type\iref{temp.param}, |
6380 | | -\tcode{is_constructible_v<T, ranges::range_reference_t<R>>} is \tcode{true}, and |
6381 | | -\tcode{is_copy_constructible_v<T>} is \tcode{true}. |
6382 | | - |
6383 | | -\pnum |
6384 | | -Let $V$ be the pack of values of type \tcode{info} |
6385 | | -of the same size as \tcode{r}, |
6386 | | -where the $i^\text{th}$ element is \tcode{reflect_constant($\tcode{e}_i$)}, |
6387 | | -where $\tcode{e}_i$ is the $i^\text{th}$ element of \tcode{r}. |
6388 | | - |
6389 | | -\pnum |
6390 | | -Let $P$ be |
6391 | | -\begin{itemize} |
6392 | | -\item |
6393 | | - If \tcode{sizeof...($V$) > 0} is \tcode{true}, |
6394 | | - then the template parameter object\iref{temp.param} |
6395 | | - of type \tcode{const T[\brk{}sizeof...(\brk{}$V$)]} |
6396 | | - initialized with \tcode{\{[:$V$:]...\}}. |
6397 | | -\item |
6398 | | - Otherwise, the template parameter object |
6399 | | - of type \tcode{const array<T, 0>} |
6400 | | - initialized with \tcode{\{\}}. |
6401 | | -\end{itemize} |
6402 | | - |
6403 | | -\pnum |
6404 | | -\returns |
6405 | | -\tcode{\reflexpr{$P$}}. |
6406 | | - |
6407 | | -\pnum |
6408 | | -\throws |
6409 | | -\tcode{meta::exception} unless |
6410 | | -\tcode{reflect_constant(e)} is a constant subexpression |
6411 | | -for every element \tcode{e} of \tcode{r}. |
6412 | | - |
6413 | | -\pnum |
6414 | | -\begin{note} |
6415 | | -$P$ is a potentially non-unique object\iref{intro.object}. |
6416 | | -\end{note} |
6417 | | -\end{itemdescr} |
6418 | | - |
6419 | 6413 | \rSec2[meta.reflection.define.aggregate]{Reflection class definition generation} |
6420 | 6414 |
|
6421 | 6415 | \indexlibraryglobal{data_member_options}% |
|
0 commit comments