|
4072 | 4072 | Otherwise, \tcode{r} represents a variable; |
4073 | 4073 | a reflection of the object declared by that variable. |
4074 | 4074 | \end{itemize} |
4075 | | -\begin{example} |
4076 | | -\begin{codeblock} |
4077 | | -int x; |
4078 | | -int& y = x; |
4079 | | - |
4080 | | -static_assert(^^x != ^^y); // OK, \tcode{r} and \tcode{y} are different variables so their |
4081 | | - // reflections compare different |
4082 | | -static_assert(object_of(^^x) == object_of(^^y)); // OK, because \tcode{y} is a reference |
4083 | | - // to \tcode{x}, their underlying objects are the same |
4084 | | -\end{codeblock} |
4085 | | -\end{example} |
4086 | 4075 |
|
4087 | 4076 | \pnum |
4088 | 4077 | \throws |
|
4102 | 4091 | currently under evaluation. |
4103 | 4092 | \end{itemize} |
4104 | 4093 | \end{itemize} |
| 4094 | + |
| 4095 | +\pnum |
| 4096 | +\begin{example} |
| 4097 | +\begin{codeblock} |
| 4098 | +int x; |
| 4099 | +int& y = x; |
| 4100 | + |
| 4101 | +static_assert(^^x != ^^y); // OK, \tcode{r} and \tcode{y} are different variables so their |
| 4102 | + // reflections compare different |
| 4103 | +static_assert(object_of(^^x) == object_of(^^y)); // OK, because \tcode{y} is a reference |
| 4104 | + // to \tcode{x}, their underlying objects are the same |
| 4105 | +\end{codeblock} |
| 4106 | +\end{example} |
4105 | 4107 | \end{itemdescr} |
4106 | 4108 |
|
4107 | 4109 | \indexlibraryglobal{constant_of}% |
|
4126 | 4128 | return reflect_constant([: @$R$@ :]); |
4127 | 4129 | } |
4128 | 4130 | \end{codeblock} |
| 4131 | + |
| 4132 | +\pnum |
| 4133 | +\throws |
| 4134 | +\tcode{meta::exception} unless |
| 4135 | +either \tcode{r} represents an annotation or |
| 4136 | +\tcode{[: $R$ :]} is a valid |
| 4137 | +\grammarterm{splice-expression}\iref{expr.prim.splice}. |
| 4138 | + |
| 4139 | +\pnum |
4129 | 4140 | \begin{example} |
4130 | 4141 | \begin{codeblock} |
4131 | 4142 | constexpr int x = 0; |
|
4155 | 4166 | constexpr info r = constant_of(fn()); // error: \tcode{x} is outside its lifetime |
4156 | 4167 | \end{codeblock} |
4157 | 4168 | \end{example} |
4158 | | - |
4159 | | -\pnum |
4160 | | -\throws |
4161 | | -\tcode{meta::exception} unless |
4162 | | -either \tcode{r} represents an annotation or |
4163 | | -\tcode{[: $R$ :]} is a valid |
4164 | | -\grammarterm{splice-expression}\iref{expr.prim.splice}. |
4165 | 4169 | \end{itemdescr} |
4166 | 4170 |
|
4167 | 4171 | \indexlibraryglobal{is_public}% |
|
4464 | 4468 | \tcode{true} if \tcode{dealias(r)} represents a type that is enumerable |
4465 | 4469 | from some point in the evaluation context. |
4466 | 4470 | Otherwise, \tcode{false}. |
| 4471 | + |
| 4472 | +\pnum |
4467 | 4473 | \begin{example} |
4468 | 4474 | \begin{codeblock} |
4469 | 4475 | class S; |
|
4864 | 4870 | Otherwise, \tcode{\reflexpr{$E$}}. |
4865 | 4871 | \end{itemize} |
4866 | 4872 | \end{itemize} |
| 4873 | + |
| 4874 | +\pnum |
| 4875 | +\throws |
| 4876 | +\tcode{meta::exception} unless |
| 4877 | +\tcode{has_parent(r)} is \tcode{true}. |
| 4878 | + |
| 4879 | +\pnum |
4867 | 4880 | \begin{example} |
4868 | 4881 | \begin{codeblock} |
4869 | 4882 | struct I { }; |
|
4887 | 4900 | static_assert(parent_of(^^F::A) == ^^F::N); |
4888 | 4901 | \end{codeblock} |
4889 | 4902 | \end{example} |
4890 | | - |
4891 | | -\pnum |
4892 | | -\throws |
4893 | | -\tcode{meta::exception} unless |
4894 | | -\tcode{has_parent(r)} is \tcode{true}. |
4895 | 4903 | \end{itemdescr} |
4896 | 4904 |
|
4897 | 4905 | \indexlibraryglobal{dealias}% |
|
4903 | 4911 | \pnum |
4904 | 4912 | \returns |
4905 | 4913 | A reflection representing the underlying entity of what \tcode{r} represents. |
| 4914 | + |
| 4915 | +\pnum |
| 4916 | +\throws |
| 4917 | +\tcode{meta::exception} unless |
| 4918 | +\tcode{r} represents an entity. |
| 4919 | + |
| 4920 | +\pnum |
4906 | 4921 | \begin{example} |
4907 | 4922 | \begin{codeblock} |
4908 | 4923 | using X = int; |
|
4912 | 4927 | static_assert(dealias(^^Y) == ^^int); |
4913 | 4928 | \end{codeblock} |
4914 | 4929 | \end{example} |
4915 | | - |
4916 | | -\pnum |
4917 | | -\throws |
4918 | | -\tcode{meta::exception} unless |
4919 | | -\tcode{r} represents an entity. |
4920 | 4930 | \end{itemdescr} |
4921 | 4931 |
|
4922 | 4932 | \indexlibraryglobal{has_template_arguments}% |
|
4994 | 5004 | Otherwise, $R$ is a reflection representing the value of $A$. |
4995 | 5005 | \end{itemize} |
4996 | 5006 | \end{itemize} |
| 5007 | + |
| 5008 | +\pnum |
| 5009 | +\throws |
| 5010 | +\tcode{meta::exception} unless |
| 5011 | +\tcode{has_template_arguments(r)} is \tcode{true}. |
| 5012 | + |
| 5013 | +\pnum |
4997 | 5014 | \begin{example} |
4998 | 5015 | \begin{codeblock} |
4999 | 5016 | template<class T, class U = T> struct Pair { }; |
|
5019 | 5036 | static_assert(template_arguments_of(T)[3] == ^^PairPtr); |
5020 | 5037 | \end{codeblock} |
5021 | 5038 | \end{example} |
5022 | | - |
5023 | | -\pnum |
5024 | | -\throws |
5025 | | -\tcode{meta::exception} unless |
5026 | | -\tcode{has_template_arguments(r)} is \tcode{true}. |
5027 | 5039 | \end{itemdescr} |
5028 | 5040 |
|
5029 | 5041 | \indexlibraryglobal{parameters_of}% |
|
5243 | 5255 | is \tcode{\exposid{ctx-scope}($S$)}, |
5244 | 5256 | where $S$ is the immediate scope of \tcode{\exposid{eval-point}($P$)} |
5245 | 5257 | and $P$ is the point at which the invocation of \tcode{current} lexically appears. |
| 5258 | + |
| 5259 | +\pnum |
| 5260 | +\remarks |
| 5261 | +\tcode{current} is not an addressable function\iref{namespace.std}. |
| 5262 | +An invocation of \tcode{current} that appears at a program point $P$ |
| 5263 | +is value-dependent\iref{temp.dep.constexpr} |
| 5264 | +if \tcode{\exposid{eval-point}\brk{}(\brk{}$P$)} is enclosed by a scope |
| 5265 | +corresponding to a templated entity. |
| 5266 | + |
| 5267 | +\pnum |
5246 | 5268 | \begin{example} |
5247 | 5269 | \begin{codeblock} |
5248 | 5270 | struct A { |
|
5284 | 5306 | } |
5285 | 5307 | \end{codeblock} |
5286 | 5308 | \end{example} |
5287 | | - |
5288 | | -\pnum |
5289 | | -\remarks |
5290 | | -\tcode{current} is not an addressable function\iref{namespace.std}. |
5291 | | -An invocation of \tcode{current} that appears at a program point $P$ |
5292 | | -is value-dependent\iref{temp.dep.constexpr} |
5293 | | -if \tcode{\exposid{eval-point}\brk{}(\brk{}$P$)} is enclosed by a scope |
5294 | | -corresponding to a templated entity. |
5295 | 5309 | \end{itemdescr} |
5296 | 5310 |
|
5297 | 5311 | \begin{itemdecl} |
|
5411 | 5425 | The definitions of when a class member or base class is accessible from a point $P$ |
5412 | 5426 | do not consider whether a declaration of that entity is reachable from $P$. |
5413 | 5427 | \end{note} |
| 5428 | + |
| 5429 | +\pnum |
| 5430 | +\throws |
| 5431 | +\tcode{meta::exception} if |
| 5432 | +\begin{itemize} |
| 5433 | +\item |
| 5434 | + \tcode{r} represents a class member |
| 5435 | + for which \tcode{\exposid{PARENT-CLS}(r)} is an incomplete class or |
| 5436 | +\item |
| 5437 | + \tcode{r} represents a direct base class relationship $(D, B)$ |
| 5438 | + for which $D$ is incomplete. |
| 5439 | +\end{itemize} |
| 5440 | + |
| 5441 | +\pnum |
5414 | 5442 | \begin{example} |
5415 | 5443 | \begin{codeblock} |
5416 | 5444 | consteval access_context fn() { |
|
5429 | 5457 | static_assert(is_accessible(Cls::r, access_context::unchecked())); // OK |
5430 | 5458 | \end{codeblock} |
5431 | 5459 | \end{example} |
5432 | | - |
5433 | | -\pnum |
5434 | | -\throws |
5435 | | -\tcode{meta::exception} if |
5436 | | -\begin{itemize} |
5437 | | -\item |
5438 | | - \tcode{r} represents a class member |
5439 | | - for which \tcode{\exposid{PARENT-CLS}(r)} is an incomplete class or |
5440 | | -\item |
5441 | | - \tcode{r} represents a direct base class relationship $(D, B)$ |
5442 | | - for which $D$ is incomplete. |
5443 | | -\end{itemize} |
5444 | 5460 | \end{itemdescr} |
5445 | 5461 |
|
5446 | 5462 | \indexlibraryglobal{has_inaccessible_nonstatic_data_members}% |
|
5605 | 5621 | Implicitly-declared special members |
5606 | 5622 | appear after any user-declared members\iref{special}. |
5607 | 5623 | \end{note} |
| 5624 | + |
| 5625 | +\pnum |
| 5626 | +\throws |
| 5627 | +\tcode{meta::exception} unless |
| 5628 | +\tcode{dealias(r)} is a reflection representing either |
| 5629 | +a class type that is complete from some point in the evaluation context |
| 5630 | +or a namespace. |
| 5631 | + |
| 5632 | +\pnum |
5608 | 5633 | \begin{example} |
5609 | 5634 | \begin{codeblock} |
5610 | 5635 | // TU1 |
|
5639 | 5664 | // representing \tcode{S::I} |
5640 | 5665 | \end{codeblock} |
5641 | 5666 | \end{example} |
5642 | | - |
5643 | | -\pnum |
5644 | | -\throws |
5645 | | -\tcode{meta::exception} unless |
5646 | | -\tcode{dealias(r)} is a reflection representing either |
5647 | | -a class type that is complete from some point in the evaluation context |
5648 | | -or a namespace. |
5649 | 5667 | \end{itemdescr} |
5650 | 5668 |
|
5651 | 5669 | \indexlibraryglobal{bases_of}% |
|
5969 | 5987 | \begin{note} |
5970 | 5988 | The order in which two annotations appear is otherwise unspecified. |
5971 | 5989 | \end{note} |
| 5990 | + |
| 5991 | +\pnum |
| 5992 | +\throws |
| 5993 | +\tcode{meta::exception} unless |
| 5994 | +\tcode{item} represents a |
| 5995 | +type, |
| 5996 | +type alias, |
| 5997 | +variable, |
| 5998 | +function, |
| 5999 | +namespace, |
| 6000 | +enumerator, |
| 6001 | +direct base class relationship, or |
| 6002 | +non-static data member. |
| 6003 | + |
| 6004 | +\pnum |
5972 | 6005 | \begin{example} |
5973 | 6006 | \begin{codeblock} |
5974 | 6007 | [[=1]] void f(); |
|
6003 | 6036 | static_assert(annotations_of(^^x)[0] == annotations_of(^^y)[0]); |
6004 | 6037 | \end{codeblock} |
6005 | 6038 | \end{example} |
6006 | | - |
6007 | | -\pnum |
6008 | | -\throws |
6009 | | -\tcode{meta::exception} unless |
6010 | | -\tcode{item} represents a |
6011 | | -type, |
6012 | | -type alias, |
6013 | | -variable, |
6014 | | -function, |
6015 | | -namespace, |
6016 | | -enumerator, |
6017 | | -direct base class relationship, or |
6018 | | -non-static data member. |
6019 | 6039 | \end{itemdescr} |
6020 | 6040 |
|
6021 | 6041 | \indexlibraryglobal{annotations_of_with_type}% |
|
0 commit comments