Skip to content

Commit f07c133

Browse files
Eisenwavetkoeppe
authored andcommitted
P2996R13 Reflection for C++26 [lib]
1 parent 37a92d0 commit f07c133

File tree

6 files changed

+3527
-19
lines changed

6 files changed

+3527
-19
lines changed

source/compatibility.tex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@
253253
\libheaderref{hive},
254254
\libheaderrefx{inplace_vector}{inplace.vector.syn},
255255
\libheaderref{linalg},
256+
%FIXME: \libheaderref{meta} after renaming to meta.syn
257+
\libheaderrefx{meta}{meta.type.synop},
256258
\libheaderref{rcu},
257259
\libheaderref{simd},
258260
\libheaderref{stdbit.h},

source/lib-intro.tex

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,11 @@
368368
and also define the function as deleted.
369369
\end{example}
370370

371+
\item
372+
\constantwhen
373+
the conditions that are required for a call to the function
374+
to be a constant subexpression\iref{defns.const.subexpr}.
375+
371376
\item
372377
\expects
373378
conditions that the function assumes to hold whenever it is called;
@@ -454,6 +459,7 @@
454459
Next, the semantics of the code sequence are determined by the
455460
\Fundescx{Constraints},
456461
\Fundescx{Mandates},
462+
\Fundescx{Constant When},
457463
\Fundescx{Preconditions},
458464
\Fundescx{Hardened preconditions},
459465
\Fundescx{Effects},
@@ -1223,8 +1229,8 @@
12231229
\tcode{<flat_map>} \\
12241230
\tcode{<flat_set>} \\
12251231
\tcode{<format>} \\
1226-
\tcode{<forward_list>} \\
12271232
\columnbreak
1233+
\tcode{<forward_list>} \\
12281234
\tcode{<fstream>} \\
12291235
\tcode{<functional>} \\
12301236
\tcode{<future>} \\
@@ -1248,8 +1254,9 @@
12481254
\tcode{<mdspan>} \\
12491255
\tcode{<memory>} \\
12501256
\tcode{<memory_resource>} \\
1251-
\tcode{<mutex>} \\
12521257
\columnbreak
1258+
\tcode{<meta>} \\
1259+
\tcode{<mutex>} \\
12531260
\tcode{<new>} \\
12541261
\tcode{<numbers>} \\
12551262
\tcode{<numeric>} \\
@@ -1271,9 +1278,9 @@
12711278
\tcode{<span>} \\
12721279
\tcode{<spanstream>} \\
12731280
\tcode{<sstream>} \\
1281+
\columnbreak
12741282
\tcode{<stack>} \\
12751283
\tcode{<stacktrace>} \\
1276-
\columnbreak
12771284
\tcode{<stdexcept>} \\
12781285
\tcode{<stdfloat>} \\
12791286
\tcode{<stop_token>} \\
@@ -3082,6 +3089,26 @@
30823089
either a standard library non-static member function\iref{member.functions}
30833090
or an instantiation of a standard library member function template.
30843091

3092+
\pnum
3093+
Let \tcode{\placeholder{F}} denote
3094+
a standard library function or function template.
3095+
Unless \tcode{\placeholder{F}} is designated an addressable function,
3096+
it is unspecified if or how
3097+
a reflection value designating the associated entity can be formed.
3098+
%FIXME: Why is this not an example, but a note that begins with "For example"?
3099+
\begin{note}
3100+
For example, it is possible that \tcode{std::meta::members_of}
3101+
will not return reflections of standard library functions
3102+
that an implementation handles through an extra-linguistic mechanism.
3103+
\end{note}
3104+
3105+
\pnum
3106+
Let \tcode{\placeholder{F}} denote
3107+
a standard library class or class template specialization.
3108+
It is unspecified if or how
3109+
a reflection value can be formed to any private member of \tcode{\placeholder{F}},
3110+
or what the names of such members may be.
3111+
30853112
\pnum
30863113
A translation unit shall not declare namespace \tcode{std} to be an inline namespace\iref{namespace.def}.
30873114

source/macros.tex

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@
363363
\newcommand{\required}{\Fundesc{Required behavior}}
364364
\newcommand{\constraints}{\Fundesc{Constraints}}
365365
\newcommand{\mandates}{\Fundesc{Mandates}}
366+
\newcommand{\constantwhen}{\Fundesc{Constant When}}
366367
\newcommand{\expects}{\Fundesc{Preconditions}}
367368
\newcommand{\hardexpects}{\Fundesc{Hardened preconditions}}
368369
\newcommand{\effects}{\Fundesc{Effects}}
@@ -465,6 +466,10 @@
465466
\newcommand{\unspecuniqtype}{\UNSP{unspecified unique type}}
466467
\newcommand{\unspecalloctype}{\UNSP{unspecified allocator type}}
467468

469+
%% Convenience macro for double carets in expressions,
470+
%% particularly within \tcode.
471+
\newcommand{\reflexpr}[1]{\caret\caret#1}
472+
468473
%% Manual insertion of italic corrections, for aligning in the presence
469474
%% of the above annotations.
470475
\newlength{\itcorrwidth}

0 commit comments

Comments
 (0)