tmp/tmpdgyh2inu/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Annotation reflection <a id="meta.reflection.annotation">[[meta.reflection.annotation]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
consteval vector<info> annotations_of(info item);
|
| 5 |
+
```
|
| 6 |
+
|
| 7 |
+
Let E be
|
| 8 |
+
|
| 9 |
+
- the corresponding *base-specifier* if `item` represents a direct base
|
| 10 |
+
class relationship,
|
| 11 |
+
- otherwise, the entity represented by `item`.
|
| 12 |
+
|
| 13 |
+
*Returns:* A `vector` containing all of the reflections R representing
|
| 14 |
+
each annotation applying to each declaration of E that precedes either
|
| 15 |
+
some point in the evaluation context [[expr.const]] or a point
|
| 16 |
+
immediately following the *class-specifier* of the outermost class for
|
| 17 |
+
which such a point is in a complete-class context. For any two
|
| 18 |
+
reflections R₁ and R₂ in the returned `vector`, if the annotation
|
| 19 |
+
represented by R₁ precedes the annotation represented by R₂, then R₁
|
| 20 |
+
appears before R₂. If R₁ and R₂ represent annotations from the same
|
| 21 |
+
translation unit T, any element in the returned `vector` between R₁ and
|
| 22 |
+
R₂ represents an annotation from T.
|
| 23 |
+
|
| 24 |
+
[*Note 1*: The order in which two annotations appear is otherwise
|
| 25 |
+
unspecified. — *end note*]
|
| 26 |
+
|
| 27 |
+
*Throws:* `meta::exception` unless `item` represents a type, type alias,
|
| 28 |
+
variable, function, namespace, enumerator, direct base class
|
| 29 |
+
relationship, or non-static data member.
|
| 30 |
+
|
| 31 |
+
[*Example 1*:
|
| 32 |
+
|
| 33 |
+
``` cpp
|
| 34 |
+
[[=1]] void f();
|
| 35 |
+
[[=2, =3]] void g();
|
| 36 |
+
void g [[=4]] ();
|
| 37 |
+
|
| 38 |
+
static_assert(annotations_of(^^f).size() == 1);
|
| 39 |
+
static_assert(annotations_of(^^g).size() == 3);
|
| 40 |
+
static_assert([: constant_of(annotations_of(^^g)[0]) :] == 2);
|
| 41 |
+
static_assert(extract<int>(annotations_of(^^g)[1]) == 3);
|
| 42 |
+
static_assert(extract<int>(annotations_of(^^g)[2]) == 4);
|
| 43 |
+
|
| 44 |
+
struct Option { bool value; };
|
| 45 |
+
|
| 46 |
+
struct C {
|
| 47 |
+
[[=Option{true}]] int a;
|
| 48 |
+
[[=Option{false}]] int b;
|
| 49 |
+
};
|
| 50 |
+
|
| 51 |
+
static_assert(extract<Option>(annotations_of(^^C::a)[0]).value);
|
| 52 |
+
static_assert(!extract<Option>(annotations_of(^^C::b)[0]).value);
|
| 53 |
+
|
| 54 |
+
template<class T>
|
| 55 |
+
struct [[=42]] D { };
|
| 56 |
+
|
| 57 |
+
constexpr std::meta::info a1 = annotations_of(^^D<int>)[0];
|
| 58 |
+
constexpr std::meta::info a2 = annotations_of(^^D<char>)[0];
|
| 59 |
+
static_assert(a1 != a2);
|
| 60 |
+
static_assert(constant_of(a1) == constant_of(a2));
|
| 61 |
+
|
| 62 |
+
[[=1]] int x, y;
|
| 63 |
+
static_assert(annotations_of(^^x)[0] == annotations_of(^^y)[0]);
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
— *end example*]
|
| 67 |
+
|
| 68 |
+
``` cpp
|
| 69 |
+
consteval vector<info> annotations_of_with_type(info item, info type);
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
*Returns:* A `vector` containing each element `e` of
|
| 73 |
+
`annotations_of(item)` where
|
| 74 |
+
|
| 75 |
+
``` cpp
|
| 76 |
+
remove_const(type_of(e)) == remove_const(type)
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
is `true`, preserving their order.
|
| 80 |
+
|
| 81 |
+
*Throws:* `meta::exception` unless
|
| 82 |
+
|
| 83 |
+
- `annotations_of(item)` is a constant expression and
|
| 84 |
+
- `dealias(type)` represents a type and `is_complete_type(type)` is
|
| 85 |
+
`true`.
|
| 86 |
+
|