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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Reflection type traits <a id="meta.reflection.traits">[[meta.reflection.traits]]</a>
|
| 2 |
+
|
| 3 |
+
This subclause specifies `consteval` functions to query the properties
|
| 4 |
+
of types [[meta.unary]], query the relationships between types
|
| 5 |
+
[[meta.rel]], or transform types [[meta.trans]], during program
|
| 6 |
+
translation. Each `consteval` function declared in this class has an
|
| 7 |
+
associated class template declared elsewhere in this document.
|
| 8 |
+
|
| 9 |
+
Every function and function template declared in this subclause throws
|
| 10 |
+
an exception of type `meta::exception` unless the following conditions
|
| 11 |
+
are met:
|
| 12 |
+
|
| 13 |
+
- For every parameter `p` of type `info`, `is_type(p)` is `true`.
|
| 14 |
+
- For every parameter `r` whose type is constrained on
|
| 15 |
+
`reflection_range`, `ranges::{}all_of({}r, is_type)` is `true`.
|
| 16 |
+
|
| 17 |
+
``` cpp
|
| 18 |
+
// associated with [meta.unary.cat], primary type categories
|
| 19 |
+
consteval bool is_void_type(info type);
|
| 20 |
+
consteval bool is_null_pointer_type(info type);
|
| 21 |
+
consteval bool is_integral_type(info type);
|
| 22 |
+
consteval bool is_floating_point_type(info type);
|
| 23 |
+
consteval bool is_array_type(info type);
|
| 24 |
+
consteval bool is_pointer_type(info type);
|
| 25 |
+
consteval bool is_lvalue_reference_type(info type);
|
| 26 |
+
consteval bool is_rvalue_reference_type(info type);
|
| 27 |
+
consteval bool is_member_object_pointer_type(info type);
|
| 28 |
+
consteval bool is_member_function_pointer_type(info type);
|
| 29 |
+
consteval bool is_enum_type(info type);
|
| 30 |
+
consteval bool is_union_type(info type);
|
| 31 |
+
consteval bool is_class_type(info type);
|
| 32 |
+
consteval bool is_function_type(info type);
|
| 33 |
+
consteval bool is_reflection_type(info type);
|
| 34 |
+
|
| 35 |
+
// associated with [meta.unary.comp], composite type categories
|
| 36 |
+
consteval bool is_reference_type(info type);
|
| 37 |
+
consteval bool is_arithmetic_type(info type);
|
| 38 |
+
consteval bool is_fundamental_type(info type);
|
| 39 |
+
consteval bool is_object_type(info type);
|
| 40 |
+
consteval bool is_scalar_type(info type);
|
| 41 |
+
consteval bool is_compound_type(info type);
|
| 42 |
+
consteval bool is_member_pointer_type(info type);
|
| 43 |
+
|
| 44 |
+
// associated with [meta.unary.prop], type properties
|
| 45 |
+
consteval bool is_const_type(info type);
|
| 46 |
+
consteval bool is_volatile_type(info type);
|
| 47 |
+
consteval bool is_trivially_copyable_type(info type);
|
| 48 |
+
consteval bool is_trivially_relocatable_type(info type);
|
| 49 |
+
consteval bool is_replaceable_type(info type);
|
| 50 |
+
consteval bool is_standard_layout_type(info type);
|
| 51 |
+
consteval bool is_empty_type(info type);
|
| 52 |
+
consteval bool is_polymorphic_type(info type);
|
| 53 |
+
consteval bool is_abstract_type(info type);
|
| 54 |
+
consteval bool is_final_type(info type);
|
| 55 |
+
consteval bool is_aggregate_type(info type);
|
| 56 |
+
consteval bool is_consteval_only_type(info type);
|
| 57 |
+
consteval bool is_signed_type(info type);
|
| 58 |
+
consteval bool is_unsigned_type(info type);
|
| 59 |
+
consteval bool is_bounded_array_type(info type);
|
| 60 |
+
consteval bool is_unbounded_array_type(info type);
|
| 61 |
+
consteval bool is_scoped_enum_type(info type);
|
| 62 |
+
|
| 63 |
+
template<reflection_range R = initializer_list<info>>
|
| 64 |
+
consteval bool is_constructible_type(info type, R&& type_args);
|
| 65 |
+
consteval bool is_default_constructible_type(info type);
|
| 66 |
+
consteval bool is_copy_constructible_type(info type);
|
| 67 |
+
consteval bool is_move_constructible_type(info type);
|
| 68 |
+
|
| 69 |
+
consteval bool is_assignable_type(info type_dst, info type_src);
|
| 70 |
+
consteval bool is_copy_assignable_type(info type);
|
| 71 |
+
consteval bool is_move_assignable_type(info type);
|
| 72 |
+
|
| 73 |
+
consteval bool is_swappable_with_type(info type1, info type2);
|
| 74 |
+
consteval bool is_swappable_type(info type);
|
| 75 |
+
|
| 76 |
+
consteval bool is_destructible_type(info type);
|
| 77 |
+
|
| 78 |
+
template<reflection_range R = initializer_list<info>>
|
| 79 |
+
consteval bool is_trivially_constructible_type(info type, R&& type_args);
|
| 80 |
+
consteval bool is_trivially_default_constructible_type(info type);
|
| 81 |
+
consteval bool is_trivially_copy_constructible_type(info type);
|
| 82 |
+
consteval bool is_trivially_move_constructible_type(info type);
|
| 83 |
+
|
| 84 |
+
consteval bool is_trivially_assignable_type(info type_dst, info type_src);
|
| 85 |
+
consteval bool is_trivially_copy_assignable_type(info type);
|
| 86 |
+
consteval bool is_trivially_move_assignable_type(info type);
|
| 87 |
+
consteval bool is_trivially_destructible_type(info type);
|
| 88 |
+
|
| 89 |
+
template<reflection_range R = initializer_list<info>>
|
| 90 |
+
consteval bool is_nothrow_constructible_type(info type, R&& type_args);
|
| 91 |
+
consteval bool is_nothrow_default_constructible_type(info type);
|
| 92 |
+
consteval bool is_nothrow_copy_constructible_type(info type);
|
| 93 |
+
consteval bool is_nothrow_move_constructible_type(info type);
|
| 94 |
+
|
| 95 |
+
consteval bool is_nothrow_assignable_type(info type_dst, info type_src);
|
| 96 |
+
consteval bool is_nothrow_copy_assignable_type(info type);
|
| 97 |
+
consteval bool is_nothrow_move_assignable_type(info type);
|
| 98 |
+
|
| 99 |
+
consteval bool is_nothrow_swappable_with_type(info type1, info type2);
|
| 100 |
+
consteval bool is_nothrow_swappable_type(info type);
|
| 101 |
+
|
| 102 |
+
consteval bool is_nothrow_destructible_type(info type);
|
| 103 |
+
consteval bool is_nothrow_relocatable_type(info type);
|
| 104 |
+
|
| 105 |
+
consteval bool is_implicit_lifetime_type(info type);
|
| 106 |
+
|
| 107 |
+
consteval bool has_virtual_destructor(info type);
|
| 108 |
+
|
| 109 |
+
consteval bool has_unique_object_representations(info type);
|
| 110 |
+
|
| 111 |
+
consteval bool reference_constructs_from_temporary(info type_dst, info type_src);
|
| 112 |
+
consteval bool reference_converts_from_temporary(info type_dst, info type_src);
|
| 113 |
+
|
| 114 |
+
// associated with [meta.rel], type relations
|
| 115 |
+
consteval bool is_same_type(info type1, info type2);
|
| 116 |
+
consteval bool is_base_of_type(info type_base, info type_derived);
|
| 117 |
+
consteval bool is_virtual_base_of_type(info type_base, info type_derived);
|
| 118 |
+
consteval bool is_convertible_type(info type_src, info type_dst);
|
| 119 |
+
consteval bool is_nothrow_convertible_type(info type_src, info type_dst);
|
| 120 |
+
consteval bool is_layout_compatible_type(info type1, info type2);
|
| 121 |
+
consteval bool is_pointer_interconvertible_base_of_type(info type_base, info type_derived);
|
| 122 |
+
|
| 123 |
+
template<reflection_range R = initializer_list<info>>
|
| 124 |
+
consteval bool is_invocable_type(info type, R&& type_args);
|
| 125 |
+
template<reflection_range R = initializer_list<info>>
|
| 126 |
+
consteval bool is_invocable_r_type(info type_result, info type, R&& type_args);
|
| 127 |
+
|
| 128 |
+
template<reflection_range R = initializer_list<info>>
|
| 129 |
+
consteval bool is_nothrow_invocable_type(info type, R&& type_args);
|
| 130 |
+
template<reflection_range R = initializer_list<info>>
|
| 131 |
+
consteval bool is_nothrow_invocable_r_type(info type_result, info type, R&& type_args);
|
| 132 |
+
|
| 133 |
+
// associated with [meta.trans.cv], const-volatile modifications
|
| 134 |
+
consteval info remove_const(info type);
|
| 135 |
+
consteval info remove_volatile(info type);
|
| 136 |
+
consteval info remove_cv(info type);
|
| 137 |
+
consteval info add_const(info type);
|
| 138 |
+
consteval info add_volatile(info type);
|
| 139 |
+
consteval info add_cv(info type);
|
| 140 |
+
|
| 141 |
+
// associated with [meta.trans.ref], reference modifications
|
| 142 |
+
consteval info remove_reference(info type);
|
| 143 |
+
consteval info add_lvalue_reference(info type);
|
| 144 |
+
consteval info add_rvalue_reference(info type);
|
| 145 |
+
|
| 146 |
+
// associated with [meta.trans.sign], sign modifications
|
| 147 |
+
consteval info make_signed(info type);
|
| 148 |
+
consteval info make_unsigned(info type);
|
| 149 |
+
|
| 150 |
+
// associated with [meta.trans.arr], array modifications
|
| 151 |
+
consteval info remove_extent(info type);
|
| 152 |
+
consteval info remove_all_extents(info type);
|
| 153 |
+
|
| 154 |
+
// associated with [meta.trans.ptr], pointer modifications
|
| 155 |
+
consteval info remove_pointer(info type);
|
| 156 |
+
consteval info add_pointer(info type);
|
| 157 |
+
|
| 158 |
+
// associated with [meta.trans.other], other transformations
|
| 159 |
+
consteval info remove_cvref(info type);
|
| 160 |
+
consteval info decay(info type);
|
| 161 |
+
template<reflection_range R = initializer_list<info>>
|
| 162 |
+
consteval info common_type(R&& type_args);
|
| 163 |
+
template<reflection_range R = initializer_list<info>>
|
| 164 |
+
consteval info common_reference(R&& type_args);
|
| 165 |
+
consteval info underlying_type(info type);
|
| 166 |
+
template<reflection_range R = initializer_list<info>>
|
| 167 |
+
consteval info invoke_result(info type, R&& type_args);
|
| 168 |
+
consteval info unwrap_reference(info type);
|
| 169 |
+
consteval info unwrap_ref_decay(info type);
|
| 170 |
+
```
|
| 171 |
+
|
| 172 |
+
Each function or function template declared above has the following
|
| 173 |
+
behavior based on the signature and return type of that function or
|
| 174 |
+
function template.
|
| 175 |
+
|
| 176 |
+
[*Note 1*: The associated class template need not be
|
| 177 |
+
instantiated. — *end note*]
|
| 178 |
+
|
| 179 |
+
[*Note 2*: For those functions or function templates which return a
|
| 180 |
+
reflection, that reflection always represents a type and never a type
|
| 181 |
+
alias. — *end note*]
|
| 182 |
+
|
| 183 |
+
[*Note 3*: If `t` is a reflection of the type `int` and `u` is a
|
| 184 |
+
reflection of an alias to the type `int`, then `t == u` is `false` but
|
| 185 |
+
`is_same_type(t, u)` is `true`. Also, `t == dealias(u)` is
|
| 186 |
+
`true`. — *end note*]
|
| 187 |
+
|
| 188 |
+
``` cpp
|
| 189 |
+
consteval size_t rank(info type);
|
| 190 |
+
```
|
| 191 |
+
|
| 192 |
+
*Returns:* `rank_v<`T`>`, where T is the type represented by
|
| 193 |
+
`dealias(type)`.
|
| 194 |
+
|
| 195 |
+
``` cpp
|
| 196 |
+
consteval size_t extent(info type, unsigned i = 0);
|
| 197 |
+
```
|
| 198 |
+
|
| 199 |
+
*Returns:* `extent_v<`T`, `I`>`, where T is the type represented by
|
| 200 |
+
`dealias(type)` and I is a constant equal to `i`.
|
| 201 |
+
|
| 202 |
+
``` cpp
|
| 203 |
+
consteval size_t tuple_size(info type);
|
| 204 |
+
```
|
| 205 |
+
|
| 206 |
+
*Returns:* `tuple_size_v<`T`>`, where T is the type represented by
|
| 207 |
+
`dealias(type)`.
|
| 208 |
+
|
| 209 |
+
``` cpp
|
| 210 |
+
consteval info tuple_element(size_t index, info type);
|
| 211 |
+
```
|
| 212 |
+
|
| 213 |
+
*Returns:* A reflection representing the type denoted by
|
| 214 |
+
`tuple_element_t<`I`, `T`>`, where T is the type represented by
|
| 215 |
+
`dealias(type)` and I is a constant equal to `index`.
|
| 216 |
+
|
| 217 |
+
``` cpp
|
| 218 |
+
consteval size_t variant_size(info type);
|
| 219 |
+
```
|
| 220 |
+
|
| 221 |
+
*Returns:* `variant_size_v<`T`>`, where T is the type represented by
|
| 222 |
+
`dealias(type)`.
|
| 223 |
+
|
| 224 |
+
``` cpp
|
| 225 |
+
consteval info variant_alternative(size_t index, info type);
|
| 226 |
+
```
|
| 227 |
+
|
| 228 |
+
*Returns:* A reflection representing the type denoted by
|
| 229 |
+
`variant_alternative_t<`I`, `T`>`, where T is the type represented by
|
| 230 |
+
`dealias(type)` and I is a constant equal to `index`.
|
| 231 |
+
|
| 232 |
+
``` cpp
|
| 233 |
+
consteval strong_ordering type_order(info t1, info t2);
|
| 234 |
+
```
|
| 235 |
+
|
| 236 |
+
*Returns:* `type_order_v<`T₁`, `T₂`>`, where T₁ and T₂ are the types
|
| 237 |
+
represented by `dealias(t1)` and `dealias(t2)`, respectively.
|
| 238 |
+
|