Skip to content

Commit 9a46a54

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 d200ca8 commit 9a46a54

File tree

2 files changed

+101
-107
lines changed

2 files changed

+101
-107
lines changed

source/basic.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3613,7 +3613,7 @@
36133613
the backing array of an initializer list\iref{dcl.init.ref}, or
36143614
\item
36153615
the object introduced by a call to \tcode{std::meta::reflect_constant_array}
3616-
or \tcode{std::meta::\brk{}reflect_con\-stant_string}\iref{meta.reflection.array}, or
3616+
or \tcode{std::meta::reflect_constant_string}\iref{meta.define.static}, or
36173617
\item
36183618
a subobject thereof.
36193619
\end{itemize}

source/meta.tex

Lines changed: 100 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -2920,7 +2920,13 @@
29202920
consteval bool is_string_literal(const char16_t* p);
29212921
consteval bool is_string_literal(const char32_t* p);
29222922

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+
}
29242930
template<ranges::@\libconcept{input_range}@ R>
29252931
consteval const ranges::range_value_t<R>* define_static_string(R&& r);
29262932
template<ranges::@\libconcept{input_range}@ R>
@@ -3105,13 +3111,6 @@
31053111
template<class T>
31063112
consteval info reflect_function(T& fn);
31073113

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-
31153114
// \ref{meta.reflection.define.aggregate}, class definition generation
31163115
struct data_member_options;
31173116
consteval info data_member_spec(info type, data_member_options options);
@@ -3374,11 +3373,103 @@
33743373
\end{itemize}
33753374
\end{itemdescr}
33763375

3377-
\rSec2[meta.define.static]{Promoting to static storage strings}
3376+
\rSec2[meta.define.static]{Promoting to static storage}
33783377

33793378
\pnum
33803379
The functions in this subclause promote compile-time storage into static storage.
33813380

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+
33823473
\indexlibraryglobal{define_static_string}%
33833474
\begin{itemdecl}
33843475
template<ranges::@\libconcept{input_range}@ R>
@@ -6209,103 +6300,6 @@
62096300
for a constant template parameter of type \tcode{T\&}\iref{temp.arg.nontype}.
62106301
\end{itemdescr}
62116302

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-
63096303
\rSec2[meta.reflection.define.aggregate]{Reflection class definition generation}
63106304

63116305
\indexlibraryglobal{data_member_options}%

0 commit comments

Comments
 (0)