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meta.syn]]</a>
2
+
3
+ ``` cpp
4
+ #include <initializer_list> // see [initializer.list.syn]
5
+
6
+ namespace std {
7
+ // [meta.string.literal], checking string literals
8
+ consteval bool is_string_literal(const char* p);
9
+ consteval bool is_string_literal(const wchar_t* p);
10
+ consteval bool is_string_literal(const char8_t* p);
11
+ consteval bool is_string_literal(const char16_t* p);
12
+ consteval bool is_string_literal(const char32_t* p);
13
+
14
+ // [meta.define.static], promoting to static storage
15
+ namespace meta {
16
+ template<ranges::input_range R>
17
+ consteval info reflect_constant_string(R&& r);
18
+ template<ranges::input_range R>
19
+ consteval info reflect_constant_array(R&& r);
20
+ }
21
+ template<ranges::input_range R>
22
+ consteval const ranges::range_value_t<R>* define_static_string(R&& r);
23
+ template<ranges::input_range R>
24
+ consteval span<const ranges::range_value_t<R>> define_static_array(R&& r);
25
+ template<class T>
26
+ consteval const remove_cvref_t<T>* define_static_object(T&& r);
27
+ }
28
+
29
+ namespace std::meta {
30
+ using info = decltype(^^::);
31
+
32
+ // [meta.reflection.exception], class exception
33
+ class exception;
34
+
35
+ // [meta.reflection.operators], operator representations
36
+ enum class operators {
37
+ see below;
38
+ };
39
+ using enum operators;
40
+ consteval operators operator_of(info r);
41
+ consteval string_view symbol_of(operators op);
42
+ consteval u8string_view u8symbol_of(operators op);
43
+
44
+ // [meta.reflection.names], reflection names and locations
45
+ consteval bool has_identifier(info r);
46
+
47
+ consteval string_view identifier_of(info r);
48
+ consteval u8string_view u8identifier_of(info r);
49
+
50
+ consteval string_view display_string_of(info r);
51
+ consteval u8string_view u8display_string_of(info r);
52
+
53
+ consteval source_location source_location_of(info r);
54
+
55
+ // [meta.reflection.queries], reflection queries
56
+ consteval info type_of(info r);
57
+ consteval info object_of(info r);
58
+ consteval info constant_of(info r);
59
+
60
+ consteval bool is_public(info r);
61
+ consteval bool is_protected(info r);
62
+ consteval bool is_private(info r);
63
+
64
+ consteval bool is_virtual(info r);
65
+ consteval bool is_pure_virtual(info r);
66
+ consteval bool is_override(info r);
67
+ consteval bool is_final(info r);
68
+
69
+ consteval bool is_deleted(info r);
70
+ consteval bool is_defaulted(info r);
71
+ consteval bool is_user_provided(info r);
72
+ consteval bool is_user_declared(info r);
73
+ consteval bool is_explicit(info r);
74
+ consteval bool is_noexcept(info r);
75
+
76
+ consteval bool is_bit_field(info r);
77
+ consteval bool is_enumerator(info r);
78
+ consteval bool is_annotation(info r);
79
+
80
+ consteval bool is_const(info r);
81
+ consteval bool is_volatile(info r);
82
+ consteval bool is_mutable_member(info r);
83
+ consteval bool is_lvalue_reference_qualified(info r);
84
+ consteval bool is_rvalue_reference_qualified(info r);
85
+
86
+ consteval bool has_static_storage_duration(info r);
87
+ consteval bool has_thread_storage_duration(info r);
88
+ consteval bool has_automatic_storage_duration(info r);
89
+
90
+ consteval bool has_internal_linkage(info r);
91
+ consteval bool has_module_linkage(info r);
92
+ consteval bool has_external_linkage(info r);
93
+ consteval bool has_c_language_linkage(info r);
94
+ consteval bool has_linkage(info r);
95
+
96
+ consteval bool is_complete_type(info r);
97
+ consteval bool is_enumerable_type(info r);
98
+
99
+ consteval bool is_variable(info r);
100
+ consteval bool is_type(info r);
101
+ consteval bool is_namespace(info r);
102
+ consteval bool is_type_alias(info r);
103
+ consteval bool is_namespace_alias(info r);
104
+
105
+ consteval bool is_function(info r);
106
+ consteval bool is_conversion_function(info r);
107
+ consteval bool is_operator_function(info r);
108
+ consteval bool is_literal_operator(info r);
109
+ consteval bool is_special_member_function(info r);
110
+ consteval bool is_constructor(info r);
111
+ consteval bool is_default_constructor(info r);
112
+ consteval bool is_copy_constructor(info r);
113
+ consteval bool is_move_constructor(info r);
114
+ consteval bool is_assignment(info r);
115
+ consteval bool is_copy_assignment(info r);
116
+ consteval bool is_move_assignment(info r);
117
+ consteval bool is_destructor(info r);
118
+
119
+ consteval bool is_function_parameter(info r);
120
+ consteval bool is_explicit_object_parameter(info r);
121
+ consteval bool has_default_argument(info r);
122
+ consteval bool has_ellipsis_parameter(info r);
123
+
124
+ consteval bool is_template(info r);
125
+ consteval bool is_function_template(info r);
126
+ consteval bool is_variable_template(info r);
127
+ consteval bool is_class_template(info r);
128
+ consteval bool is_alias_template(info r);
129
+ consteval bool is_conversion_function_template(info r);
130
+ consteval bool is_operator_function_template(info r);
131
+ consteval bool is_literal_operator_template(info r);
132
+ consteval bool is_constructor_template(info r);
133
+ consteval bool is_concept(info r);
134
+
135
+ consteval bool is_value(info r);
136
+ consteval bool is_object(info r);
137
+
138
+ consteval bool is_structured_binding(info r);
139
+
140
+ consteval bool is_class_member(info r);
141
+ consteval bool is_namespace_member(info r);
142
+ consteval bool is_nonstatic_data_member(info r);
143
+ consteval bool is_static_member(info r);
144
+ consteval bool is_base(info r);
145
+
146
+ consteval bool has_default_member_initializer(info r);
147
+
148
+ consteval bool has_parent(info r);
149
+ consteval info parent_of(info r);
150
+
151
+ consteval info dealias(info r);
152
+
153
+ consteval bool has_template_arguments(info r);
154
+ consteval info template_of(info r);
155
+ consteval vector<info> template_arguments_of(info r);
156
+ consteval vector<info> parameters_of(info r);
157
+ consteval info variable_of(info r);
158
+ consteval info return_type_of(info r);
159
+
160
+ // [meta.reflection.access.context], access control context
161
+ struct access_context;
162
+
163
+ // [meta.reflection.access.queries], member accessibility queries
164
+ consteval bool is_accessible(info r, access_context ctx);
165
+ consteval bool has_inaccessible_nonstatic_data_members(info r, access_context ctx);
166
+ consteval bool has_inaccessible_bases(info r, access_context ctx);
167
+ consteval bool has_inaccessible_subobjects(info r, access_context ctx);
168
+
169
+ // [meta.reflection.member.queries], reflection member queries
170
+ consteval vector<info> members_of(info r, access_context ctx);
171
+ consteval vector<info> bases_of(info type, access_context ctx);
172
+ consteval vector<info> static_data_members_of(info type, access_context ctx);
173
+ consteval vector<info> nonstatic_data_members_of(info type, access_context ctx);
174
+ consteval vector<info> subobjects_of(info type, access_context ctx);
175
+ consteval vector<info> enumerators_of(info type_enum);
176
+
177
+ // [meta.reflection.layout], reflection layout queries
178
+ struct member_offset;
179
+ consteval member_offset offset_of(info r);
180
+ consteval size_t size_of(info r);
181
+ consteval size_t alignment_of(info r);
182
+ consteval size_t bit_size_of(info r);
183
+
184
+ // [meta.reflection.annotation], annotation reflection
185
+ consteval vector<info> annotations_of(info item);
186
+ consteval vector<info> annotations_of_with_type(info item, info type);
187
+
188
+ // [meta.reflection.extract], value extraction
189
+ template<class T>
190
+ consteval T extract(info);
191
+
192
+ // [meta.reflection.substitute], reflection substitution
193
+ template<class R>
194
+ concept reflection_range = see below;
195
+
196
+ template<reflection_range R = initializer_list<info>>
197
+ consteval bool can_substitute(info templ, R&& arguments);
198
+ template<reflection_range R = initializer_list<info>>
199
+ consteval info substitute(info templ, R&& arguments);
200
+
201
+ // [meta.reflection.result], expression result reflection
202
+ template<class T>
203
+ consteval info reflect_constant(T expr);
204
+ template<class T>
205
+ consteval info reflect_object(T& expr);
206
+ template<class T>
207
+ consteval info reflect_function(T& fn);
208
+
209
+ // [meta.reflection.define.aggregate], class definition generation
210
+ struct data_member_options;
211
+ consteval info data_member_spec(info type, data_member_options options);
212
+ consteval bool is_data_member_spec(info r);
213
+ template<reflection_range R = initializer_list<info>>
214
+ consteval info define_aggregate(info type_class, R&&);
215
+
216
+ // associated with [meta.unary.cat], primary type categories
217
+ consteval bool is_void_type(info type);
218
+ consteval bool is_null_pointer_type(info type);
219
+ consteval bool is_integral_type(info type);
220
+ consteval bool is_floating_point_type(info type);
221
+ consteval bool is_array_type(info type);
222
+ consteval bool is_pointer_type(info type);
223
+ consteval bool is_lvalue_reference_type(info type);
224
+ consteval bool is_rvalue_reference_type(info type);
225
+ consteval bool is_member_object_pointer_type(info type);
226
+ consteval bool is_member_function_pointer_type(info type);
227
+ consteval bool is_enum_type(info type);
228
+ consteval bool is_union_type(info type);
229
+ consteval bool is_class_type(info type);
230
+ consteval bool is_function_type(info type);
231
+ consteval bool is_reflection_type(info type);
232
+
233
+ // associated with [meta.unary.comp], composite type categories
234
+ consteval bool is_reference_type(info type);
235
+ consteval bool is_arithmetic_type(info type);
236
+ consteval bool is_fundamental_type(info type);
237
+ consteval bool is_object_type(info type);
238
+ consteval bool is_scalar_type(info type);
239
+ consteval bool is_compound_type(info type);
240
+ consteval bool is_member_pointer_type(info type);
241
+
242
+ // associated with [meta.unary.prop], type properties
243
+ consteval bool is_const_type(info type);
244
+ consteval bool is_volatile_type(info type);
245
+ consteval bool is_trivially_copyable_type(info type);
246
+ consteval bool is_trivially_relocatable_type(info type);
247
+ consteval bool is_replaceable_type(info type);
248
+ consteval bool is_standard_layout_type(info type);
249
+ consteval bool is_empty_type(info type);
250
+ consteval bool is_polymorphic_type(info type);
251
+ consteval bool is_abstract_type(info type);
252
+ consteval bool is_final_type(info type);
253
+ consteval bool is_aggregate_type(info type);
254
+ consteval bool is_consteval_only_type(info type);
255
+ consteval bool is_signed_type(info type);
256
+ consteval bool is_unsigned_type(info type);
257
+ consteval bool is_bounded_array_type(info type);
258
+ consteval bool is_unbounded_array_type(info type);
259
+ consteval bool is_scoped_enum_type(info type);
260
+
261
+ template<reflection_range R = initializer_list<info>>
262
+ consteval bool is_constructible_type(info type, R&& type_args);
263
+ consteval bool is_default_constructible_type(info type);
264
+ consteval bool is_copy_constructible_type(info type);
265
+ consteval bool is_move_constructible_type(info type);
266
+
267
+ consteval bool is_assignable_type(info type_dst, info type_src);
268
+ consteval bool is_copy_assignable_type(info type);
269
+ consteval bool is_move_assignable_type(info type);
270
+
271
+ consteval bool is_swappable_with_type(info type1, info type2);
272
+ consteval bool is_swappable_type(info type);
273
+
274
+ consteval bool is_destructible_type(info type);
275
+
276
+ template<reflection_range R = initializer_list<info>>
277
+ consteval bool is_trivially_constructible_type(info type, R&& type_args);
278
+ consteval bool is_trivially_default_constructible_type(info type);
279
+ consteval bool is_trivially_copy_constructible_type(info type);
280
+ consteval bool is_trivially_move_constructible_type(info type);
281
+
282
+ consteval bool is_trivially_assignable_type(info type_dst, info type_src);
283
+ consteval bool is_trivially_copy_assignable_type(info type);
284
+ consteval bool is_trivially_move_assignable_type(info type);
285
+ consteval bool is_trivially_destructible_type(info type);
286
+
287
+ template<reflection_range R = initializer_list<info>>
288
+ consteval bool is_nothrow_constructible_type(info type, R&& type_args);
289
+ consteval bool is_nothrow_default_constructible_type(info type);
290
+ consteval bool is_nothrow_copy_constructible_type(info type);
291
+ consteval bool is_nothrow_move_constructible_type(info type);
292
+
293
+ consteval bool is_nothrow_assignable_type(info type_dst, info type_src);
294
+ consteval bool is_nothrow_copy_assignable_type(info type);
295
+ consteval bool is_nothrow_move_assignable_type(info type);
296
+
297
+ consteval bool is_nothrow_swappable_with_type(info type1, info type2);
298
+ consteval bool is_nothrow_swappable_type(info type);
299
+
300
+ consteval bool is_nothrow_destructible_type(info type);
301
+ consteval bool is_nothrow_relocatable_type(info type);
302
+
303
+ consteval bool is_implicit_lifetime_type(info type);
304
+
305
+ consteval bool has_virtual_destructor(info type);
306
+
307
+ consteval bool has_unique_object_representations(info type);
308
+
309
+ consteval bool reference_constructs_from_temporary(info type_dst, info type_src);
310
+ consteval bool reference_converts_from_temporary(info type_dst, info type_src);
311
+
312
+ // associated with [meta.unary.prop.query], type property queries
313
+ consteval size_t rank(info type);
314
+ consteval size_t extent(info type, unsigned i = 0);
315
+
316
+ // associated with [meta.rel], type relations
317
+ consteval bool is_same_type(info type1, info type2);
318
+ consteval bool is_base_of_type(info type_base, info type_derived);
319
+ consteval bool is_virtual_base_of_type(info type_base, info type_derived);
320
+ consteval bool is_convertible_type(info type_src, info type_dst);
321
+ consteval bool is_nothrow_convertible_type(info type_src, info type_dst);
322
+ consteval bool is_layout_compatible_type(info type1, info type2);
323
+ consteval bool is_pointer_interconvertible_base_of_type(info type_base, info type_derived);
324
+
325
+ template<reflection_range R = initializer_list<info>>
326
+ consteval bool is_invocable_type(info type, R&& type_args);
327
+ template<reflection_range R = initializer_list<info>>
328
+ consteval bool is_invocable_r_type(info type_result, info type, R&& type_args);
329
+
330
+ template<reflection_range R = initializer_list<info>>
331
+ consteval bool is_nothrow_invocable_type(info type, R&& type_args);
332
+ template<reflection_range R = initializer_list<info>>
333
+ consteval bool is_nothrow_invocable_r_type(info type_result, info type, R&& type_args);
334
+
335
+ // associated with [meta.trans.cv], const-volatile modifications
336
+ consteval info remove_const(info type);
337
+ consteval info remove_volatile(info type);
338
+ consteval info remove_cv(info type);
339
+ consteval info add_const(info type);
340
+ consteval info add_volatile(info type);
341
+ consteval info add_cv(info type);
342
+
343
+ // associated with [meta.trans.ref], reference modifications
344
+ consteval info remove_reference(info type);
345
+ consteval info add_lvalue_reference(info type);
346
+ consteval info add_rvalue_reference(info type);
347
+
348
+ // associated with [meta.trans.sign], sign modifications
349
+ consteval info make_signed(info type);
350
+ consteval info make_unsigned(info type);
351
+
352
+ // associated with [meta.trans.arr], array modifications
353
+ consteval info remove_extent(info type);
354
+ consteval info remove_all_extents(info type);
355
+
356
+ // associated with [meta.trans.ptr], pointer modifications
357
+ consteval info remove_pointer(info type);
358
+ consteval info add_pointer(info type);
359
+
360
+ // associated with [meta.trans.other], other transformations
361
+ consteval info remove_cvref(info type);
362
+ consteval info decay(info type);
363
+ template<reflection_range R = initializer_list<info>>
364
+ consteval info common_type(R&& type_args);
365
+ template<reflection_range R = initializer_list<info>>
366
+ consteval info common_reference(R&& type_args);
367
+ consteval info underlying_type(info type);
368
+ template<reflection_range R = initializer_list<info>>
369
+ consteval info invoke_result(info type, R&& type_args);
370
+ consteval info unwrap_reference(info type);
371
+ consteval info unwrap_ref_decay(info type);
372
+
373
+ consteval size_t tuple_size(info type);
374
+ consteval info tuple_element(size_t index, info type);
375
+
376
+ consteval size_t variant_size(info type);
377
+ consteval info variant_alternative(size_t index, info type);
378
+
379
+ consteval strong_ordering type_order(info type_a, info type_b);
380
+ }
381
+ ```
382
+
383
+ Unless otherwise specified, each function, and each specialization of
384
+ any function template, specified in this header is a designated
385
+ addressable function [[namespace.std]].
386
+
387
+ The behavior of any function specified in namespace `std::meta` is
388
+ *implementation-defined* when a reflection of a construct not otherwise
389
+ specified by this document is provided as an argument.
390
+
391
+ [*Note 1*: Values of type `std::meta::info` can represent
392
+ implementation-specific constructs [[basic.fundamental]]. — *end note*]
393
+
394
+ [*Note 2*:
395
+
396
+ Many of the functions specified in namespace `std::meta` have semantics
397
+ that can be affected by the completeness of class types represented by
398
+ reflection values. For such functions, for any reflection `r` such that
399
+ `dealias(r)` represents a specialization of a templated class with a
400
+ reachable definition, the specialization is implicitly instantiated
401
+ [[temp.inst]].
402
+
403
+ [*Example 1*:
404
+
405
+ ``` cpp
406
+ template<class T>
407
+ struct X {
408
+ T mem;
409
+ };
410
+
411
+ static_assert(size_of(^^X<int>) == sizeof(int)); // instantiates X<int>
412
+ ```
413
+
414
+ — *end example*]
415
+
416
+ — *end note*]
417
+
418
+ Any function in namespace `std::meta` whose return type is `string_view`
419
+ or `u8string_view` returns an object *`V`* such that
420
+ `V.data()[V.size()]` equals `'\0'`.
421
+
422
+ [*Example 2*:
423
+
424
+ ``` cpp
425
+ struct C { };
426
+
427
+ constexpr string_view sv = identifier_of(^^C);
428
+ static_assert(sv == "C");
429
+ static_assert(sv.data()[0] == 'C');
430
+ static_assert(sv.data()[1] == '{}0');
431
+ ```
432
+
433
+ — *end example*]
434
+
435
+ For the purpose of exposition, throughout this clause `^^E` is used to
436
+ indicate a reflection representing source construct `E`.
437
+