Skip to content

Commit 05c1fcb

Browse files
committed
[meta.reflection.array] Integrate subclause into [meta.define.static]
Fixes NB US 86-157 (C++26 CD). Fixes NB US 119-180 (C++26 CD). Fixes NB US 89-196 (C++26 CD).
1 parent 3c0ac90 commit 05c1fcb

File tree

1 file changed

+100
-106
lines changed

1 file changed

+100
-106
lines changed

source/meta.tex

Lines changed: 100 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -2916,7 +2916,13 @@
29162916
consteval bool is_string_literal(const char16_t* p);
29172917
consteval bool is_string_literal(const char32_t* p);
29182918

2919-
// \ref{meta.define.static}, promoting to static storage strings
2919+
// \ref{meta.define.static}, promoting to static storage
2920+
namespace meta {
2921+
template<ranges::@\libconcept{input_range}@ R>
2922+
consteval info reflect_constant_string(R&& r);
2923+
template<ranges::@\libconcept{input_range}@ R>
2924+
consteval info reflect_constant_array(R&& r);
2925+
}
29202926
template<ranges::@\libconcept{input_range}@ R>
29212927
consteval const ranges::range_value_t<R>* define_static_string(R&& r);
29222928
template<ranges::@\libconcept{input_range}@ R>
@@ -3101,13 +3107,6 @@
31013107
template<class T>
31023108
consteval info reflect_function(T& fn);
31033109

3104-
// \ref{meta.reflection.array}, promoting to static storage arrays
3105-
template<ranges::@\libconcept{input_range}@ R>
3106-
consteval info reflect_constant_string(R&& r);
3107-
3108-
template<ranges::@\libconcept{input_range}@ R>
3109-
consteval info reflect_constant_array(R&& r);
3110-
31113110
// \ref{meta.reflection.define.aggregate}, class definition generation
31123111
struct data_member_options;
31133112
consteval info data_member_spec(info type, data_member_options options);
@@ -3370,11 +3369,103 @@
33703369
\end{itemize}
33713370
\end{itemdescr}
33723371

3373-
\rSec2[meta.define.static]{Promoting to static storage strings}
3372+
\rSec2[meta.define.static]{Promoting to static storage}
33743373

33753374
\pnum
33763375
The functions in this subclause promote compile-time storage into static storage.
33773376

3377+
\indexlibraryglobal{reflect_constant_string}%
3378+
\begin{itemdecl}
3379+
template<ranges::@\libconcept{input_range}@ R>
3380+
consteval info reflect_constant_string(R&& r);
3381+
\end{itemdecl}
3382+
3383+
\begin{itemdescr}
3384+
\pnum
3385+
Let \tcode{CharT} be \tcode{ranges::range_value_t<R>}.
3386+
3387+
\pnum
3388+
\mandates
3389+
\tcode{CharT} is one of
3390+
\tcode{char},
3391+
\tcode{wchar_t},
3392+
\tcode{char8_t},
3393+
\tcode{char16_t},
3394+
\tcode{char32_t}.
3395+
3396+
\pnum
3397+
Let $V$ be the pack of values of type \tcode{CharT}
3398+
whose elements are the corresponding elements of \tcode{r},
3399+
except that if \tcode{r} refers to a string literal object,
3400+
then $V$ does not include the trailing null terminator of \tcode{r}.
3401+
3402+
\pnum
3403+
Let $P$ be the template parameter object\iref{temp.param}
3404+
of type \tcode{const CharT[sizeof...(V) + 1]}
3405+
initialized with \tcode{\{$V$..., CharT()\}}.
3406+
3407+
\pnum
3408+
\returns
3409+
\tcode{\reflexpr{$P$}}.
3410+
3411+
\pnum
3412+
\begin{note}
3413+
$P$ is a potentially non-unique object\iref{intro.object}.
3414+
\end{note}
3415+
\end{itemdescr}
3416+
3417+
\indexlibraryglobal{reflect_constant_array}%
3418+
\begin{itemdecl}
3419+
template<ranges::@\libconcept{input_range}@ R>
3420+
consteval info reflect_constant_array(R&& r);
3421+
\end{itemdecl}
3422+
3423+
\begin{itemdescr}
3424+
\pnum
3425+
Let \tcode{T} be \tcode{ranges::range_value_t<R>}.
3426+
3427+
\pnum
3428+
\mandates
3429+
\tcode{T} is a structural type\iref{temp.param},
3430+
\tcode{is_constructible_v<T, ranges::range_reference_t<R>>} is \tcode{true}, and
3431+
\tcode{is_copy_constructible_v<T>} is \tcode{true}.
3432+
3433+
\pnum
3434+
Let $V$ be the pack of values of type \tcode{info}
3435+
of the same size as \tcode{r},
3436+
where the $i^\text{th}$ element is \tcode{reflect_constant($\tcode{e}_i$)},
3437+
where $\tcode{e}_i$ is the $i^\text{th}$ element of \tcode{r}.
3438+
3439+
\pnum
3440+
Let $P$ be
3441+
\begin{itemize}
3442+
\item
3443+
If \tcode{sizeof...($V$) > 0} is \tcode{true},
3444+
then the template parameter object\iref{temp.param}
3445+
of type \tcode{const T[\brk{}sizeof...(\brk{}$V$)]}
3446+
initialized with \tcode{\{[:$V$:]...\}}.
3447+
\item
3448+
Otherwise, the template parameter object
3449+
of type \tcode{array<T, 0>}
3450+
initialized with \tcode{\{\}}.
3451+
\end{itemize}
3452+
3453+
\pnum
3454+
\returns
3455+
\tcode{\reflexpr{$P$}}.
3456+
3457+
\pnum
3458+
\throws
3459+
\tcode{meta::exception} unless
3460+
\tcode{reflect_constant(e)} is a constant subexpression
3461+
for every element \tcode{e} of \tcode{r}.
3462+
3463+
\pnum
3464+
\begin{note}
3465+
$P$ is a potentially non-unique object\iref{intro.object}.
3466+
\end{note}
3467+
\end{itemdescr}
3468+
33783469
\indexlibraryglobal{define_static_string}%
33793470
\begin{itemdecl}
33803471
template<ranges::@\libconcept{input_range}@ R>
@@ -6202,103 +6293,6 @@
62026293
for a constant template parameter of type \tcode{T\&}\iref{temp.arg.nontype}.
62036294
\end{itemdescr}
62046295

6205-
\rSec2[meta.reflection.array]{Promoting to static storage arrays}
6206-
6207-
\pnum
6208-
The functions in this subclause promote compile-time storage into static storage.
6209-
6210-
\indexlibraryglobal{reflect_constant_string}%
6211-
\begin{itemdecl}
6212-
template<ranges::@\libconcept{input_range}@ R>
6213-
consteval info reflect_constant_string(R&& r);
6214-
\end{itemdecl}
6215-
6216-
\begin{itemdescr}
6217-
\pnum
6218-
Let \tcode{CharT} be \tcode{ranges::range_value_t<R>}.
6219-
6220-
\pnum
6221-
\mandates
6222-
\tcode{CharT} is one of
6223-
\tcode{char},
6224-
\tcode{wchar_t},
6225-
\tcode{char8_t},
6226-
\tcode{char16_t},
6227-
\tcode{char32_t}.
6228-
6229-
\pnum
6230-
Let $V$ be the pack of values of type \tcode{CharT}
6231-
whose elements are the corresponding elements of \tcode{r},
6232-
except that if \tcode{r} refers to a string literal object,
6233-
then $V$ does not include the trailing null terminator of \tcode{r}.
6234-
6235-
\pnum
6236-
Let $P$ be the template parameter object\iref{temp.param}
6237-
of type \tcode{const CharT[sizeof...(V) + 1]}
6238-
initialized with \tcode{\{$V$..., CharT()\}}.
6239-
6240-
\pnum
6241-
\returns
6242-
\tcode{\reflexpr{$P$}}.
6243-
6244-
\pnum
6245-
\begin{note}
6246-
$P$ is a potentially non-unique object\iref{intro.object}.
6247-
\end{note}
6248-
\end{itemdescr}
6249-
6250-
\indexlibraryglobal{reflect_constant_array}%
6251-
\begin{itemdecl}
6252-
template<ranges::@\libconcept{input_range}@ R>
6253-
consteval info reflect_constant_array(R&& r);
6254-
\end{itemdecl}
6255-
6256-
\begin{itemdescr}
6257-
\pnum
6258-
Let \tcode{T} be \tcode{ranges::range_value_t<R>}.
6259-
6260-
\pnum
6261-
\mandates
6262-
\tcode{T} is a structural type\iref{temp.param},
6263-
\tcode{is_constructible_v<T, ranges::range_reference_t<R>>} is \tcode{true}, and
6264-
\tcode{is_copy_constructible_v<T>} is \tcode{true}.
6265-
6266-
\pnum
6267-
Let $V$ be the pack of values of type \tcode{info}
6268-
of the same size as \tcode{r},
6269-
where the $i^\text{th}$ element is \tcode{reflect_constant($\tcode{e}_i$)},
6270-
where $\tcode{e}_i$ is the $i^\text{th}$ element of \tcode{r}.
6271-
6272-
\pnum
6273-
Let $P$ be
6274-
\begin{itemize}
6275-
\item
6276-
If \tcode{sizeof...($V$) > 0} is \tcode{true},
6277-
then the template parameter object\iref{temp.param}
6278-
of type \tcode{const T[\brk{}sizeof...(\brk{}$V$)]}
6279-
initialized with \tcode{\{[:$V$:]...\}}.
6280-
\item
6281-
Otherwise, the template parameter object
6282-
of type \tcode{array<T, 0>}
6283-
initialized with \tcode{\{\}}.
6284-
\end{itemize}
6285-
6286-
\pnum
6287-
\returns
6288-
\tcode{\reflexpr{$P$}}.
6289-
6290-
\pnum
6291-
\throws
6292-
\tcode{meta::exception} unless
6293-
\tcode{reflect_constant(e)} is a constant subexpression
6294-
for every element \tcode{e} of \tcode{r}.
6295-
6296-
\pnum
6297-
\begin{note}
6298-
$P$ is a potentially non-unique object\iref{intro.object}.
6299-
\end{note}
6300-
\end{itemdescr}
6301-
63026296
\rSec2[meta.reflection.define.aggregate]{Reflection class definition generation}
63036297

63046298
\indexlibraryglobal{data_member_options}%

0 commit comments

Comments
 (0)