tmp/tmpko9ib3zg/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Reflection names and locations <a id="meta.reflection.names">[[meta.reflection.names]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
consteval bool has_identifier(info r);
|
| 5 |
+
```
|
| 6 |
+
|
| 7 |
+
*Returns:*
|
| 8 |
+
|
| 9 |
+
- If `r` represents an entity that has a typedef name for linkage
|
| 10 |
+
purposes [[dcl.typedef]], then `true`.
|
| 11 |
+
- Otherwise, if `r` represents an unnamed entity, then `false`.
|
| 12 |
+
- Otherwise, if `r` represents a class type, then
|
| 13 |
+
`!has_template_arguments(r)`.
|
| 14 |
+
- Otherwise, if `r` represents a function, then `true` if
|
| 15 |
+
`has_template_arguments(r)` is `false` and the function is not a
|
| 16 |
+
constructor, destructor, operator function, or conversion function.
|
| 17 |
+
Otherwise, `false`.
|
| 18 |
+
- Otherwise, if `r` represents a template, then `true` if `r` does not
|
| 19 |
+
represent a constructor template, operator function template, or
|
| 20 |
+
conversion function template. Otherwise, `false`.
|
| 21 |
+
- Otherwise, if `r` represents the iᵗʰ parameter of a function F that is
|
| 22 |
+
an (implicit or explicit) specialization of a templated function T and
|
| 23 |
+
the iᵗʰ parameter of the instantiated declaration of T whose template
|
| 24 |
+
arguments are those of F would be instantiated from a pack, then
|
| 25 |
+
`false`.
|
| 26 |
+
- Otherwise, if `r` represents the parameter P of a function F, then let
|
| 27 |
+
S be the set of declarations, ignoring any explicit instantiations,
|
| 28 |
+
that precede some point in the evaluation context and that declare
|
| 29 |
+
either F or a templated function of which F is a specialization;
|
| 30 |
+
`true` if
|
| 31 |
+
- there is a declaration D in S that introduces a name N for either P
|
| 32 |
+
or the parameter corresponding to P in the templated function that D
|
| 33 |
+
declares and
|
| 34 |
+
- no declaration in S does so using any name other than N.
|
| 35 |
+
|
| 36 |
+
Otherwise, `false`.
|
| 37 |
+
\[*Example 1*:
|
| 38 |
+
void fun(int);
|
| 39 |
+
constexpr std::meta::info r = parameters_of(^^fun)[0];
|
| 40 |
+
static_assert(!has_identifier(r));
|
| 41 |
+
|
| 42 |
+
void fun(int x);
|
| 43 |
+
static_assert(has_identifier(r));
|
| 44 |
+
|
| 45 |
+
void fun(int x);
|
| 46 |
+
static_assert(has_identifier(r));
|
| 47 |
+
|
| 48 |
+
void poison() {
|
| 49 |
+
void fun(int y);
|
| 50 |
+
}
|
| 51 |
+
static_assert(!has_identifier(r));
|
| 52 |
+
|
| 53 |
+
— *end example*]
|
| 54 |
+
- Otherwise, if `r` represents a variable, then `false` if the
|
| 55 |
+
declaration of that variable was instantiated from a function
|
| 56 |
+
parameter pack. Otherwise, `!has_template_arguments(r)`.
|
| 57 |
+
- Otherwise, if `r` represents a structured binding, then `false` if the
|
| 58 |
+
declaration of that structured binding was instantiated from a
|
| 59 |
+
structured binding pack. Otherwise, `true`.
|
| 60 |
+
- Otherwise, if `r` represents a type alias, then
|
| 61 |
+
`!has_template_arguments(r)`.
|
| 62 |
+
- Otherwise, if `r` represents an enumerator, non-static-data member,
|
| 63 |
+
namespace, or namespace alias, then `true`.
|
| 64 |
+
- Otherwise, if `r` represents a direct base class relationship, then
|
| 65 |
+
`has_identifier(type_of(r))`.
|
| 66 |
+
- Otherwise, `r` represents a data member description
|
| 67 |
+
(T, N, A, W, *NUA*)[[class.mem.general]]; `true` if N is not $\bot$.
|
| 68 |
+
Otherwise, `false`.
|
| 69 |
+
|
| 70 |
+
``` cpp
|
| 71 |
+
consteval string_view identifier_of(info r);
|
| 72 |
+
consteval u8string_view u8identifier_of(info r);
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
Let E be UTF-8 for `u8identifier_of`, and otherwise the ordinary literal
|
| 76 |
+
encoding.
|
| 77 |
+
|
| 78 |
+
*Returns:* An NTMBS, encoded with E, determined as follows:
|
| 79 |
+
|
| 80 |
+
- If `r` represents an entity with a typedef name for linkage purposes,
|
| 81 |
+
then that name.
|
| 82 |
+
- Otherwise, if `r` represents a literal operator or literal operator
|
| 83 |
+
template, then the *ud-suffix* of the operator or operator template.
|
| 84 |
+
- Otherwise, if `r` represents the parameter P of a function F, then let
|
| 85 |
+
S be the set of declarations, ignoring any explicit instantiations,
|
| 86 |
+
that precede some point in the evaluation context and that declare
|
| 87 |
+
either F or a templated function of which F is a specialization; the
|
| 88 |
+
name that was introduced by a declaration in S for the parameter
|
| 89 |
+
corresponding to P.
|
| 90 |
+
- Otherwise, if `r` represents an entity, then the identifier introduced
|
| 91 |
+
by the declaration of that entity.
|
| 92 |
+
- Otherwise, if `r` represents a direct base class relationship, then
|
| 93 |
+
`identifier_of(type_of(r))` or `u8identifier_of(type_of(r))`,
|
| 94 |
+
respectively.
|
| 95 |
+
- Otherwise, `r` represents a data member description
|
| 96 |
+
(T, N, A, W, NUA)[[class.mem.general]]; a `string_view` or
|
| 97 |
+
`u8string_view`, respectively, containing the identifier N.
|
| 98 |
+
|
| 99 |
+
*Throws:* `meta::exception` unless `has_identifier(r)` is `true` and the
|
| 100 |
+
identifier that would be returned (see above) is representable by E.
|
| 101 |
+
|
| 102 |
+
``` cpp
|
| 103 |
+
consteval string_view display_string_of(info r);
|
| 104 |
+
consteval u8string_view u8display_string_of(info r);
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
*Returns:* An *implementation-defined* `string_view` or `u8string_view`,
|
| 108 |
+
respectively.
|
| 109 |
+
|
| 110 |
+
*Recommended practice:* Where possible, implementations should return a
|
| 111 |
+
string suitable for identifying the represented construct.
|
| 112 |
+
|
| 113 |
+
``` cpp
|
| 114 |
+
consteval source_location source_location_of(info r);
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
*Returns:* If `r` represents a value, a type other than a class type or
|
| 118 |
+
an enumeration type, the global namespace, or a data member description,
|
| 119 |
+
then `source_location{}`. Otherwise, an *implementation-defined*
|
| 120 |
+
`source_location` value.
|
| 121 |
+
|
| 122 |
+
*Recommended practice:* If `r` represents an entity with a definition
|
| 123 |
+
that is reachable from the evaluation context, a value corresponding to
|
| 124 |
+
a definition should be returned.
|
| 125 |
+
|