diff --git a/2996_reflection/p2996r2.html b/2996_reflection/p2996r2.html index 06003976..343adf3c 100644 --- a/2996_reflection/p2996r2.html +++ b/2996_reflection/p2996r2.html @@ -631,19 +631,23 @@
<meta>
synopsis+++ ++1 Mandates:
+r
is a reflection designating either a class type or a namespace and(std::predicate<Fs, info> && ...)
istrue
.2 Returns: A
+ +vector
containing the reflections of all the membersm
of the entity designated byr
such that(filters(m) && ...)
istrue
, in the order in which they are declared. [ Note 1: Base classes precede any members and are returned in the order they are listed in the base-specifier-list. — end note ]3 Mandates:
+class_type
designates a class type.4 Effects: Equivalent to
+ +return members_of(class_type, is_base, filters...);
5 Mandates:
+class_type
designates a class type.6 Effects: Equivalent to
+ +return members_of(class_type, is_variable);
7 Mandates:
+class_type
designates a class type.8 Effects: Equivalent to
+ +return members_of(class_type, is_nsdm);
9 Mandates:
+class_type
designates a class type.10 Returns: A
+ +vector
containing all the reflections inbases_of(class_type)
followed by all the reflections innonstatic_data_members_of(class_type)
.11 Mandates:
+enum_type
designates an enumeration.12 Returns: A
+vector
containing the reflections of each enumerator of the enumeration designated byenum_type
.
--1 Subclause [meta.reflection.unary] contains consteval functions that may be used to query the properties of a type at compile time.
-2 For each function taking an argument of type
+meta::info
whose name containstype
, that argument shall be a reflection of a type or type-alias. For each function taking an argument of typespan<const meta::info>
namedtype_args
, eachmeta::info
in thatspan
shall be a reflection of a type or a type-alias.1 Subclause [meta.reflection.unary] contains consteval functions that may be used to query the properties of a type at compile time.
+2 For each function taking an argument of type
meta::info
whose name containstype
, that argument shall be a reflection of a type or type-alias. For each function taking an argument of typespan<const meta::info>
namedtype_args
, eachmeta::info
in thatspan
shall be a reflection of a type or a type-alias.
--1 For any type
-T
, for each functionstd::meta::TRAIT
defined in this clause,std::meta::TRAIT(^T)
equals the value of the corresponding unary type traitstd::TRAIT_v<T>
as specified in 21.3.5.2 [meta.unary.cat].-consteval bool is_void(info type); -consteval bool is_null_pointer(info type); -consteval bool is_integral(info type); -consteval bool is_floating_point(info type); -consteval bool is_array(info type); -consteval bool is_pointer(info type); -consteval bool is_lvalue_reference(info type); -consteval bool is_rvalue_reference(info type); -consteval bool is_member_object_pointer(info type); -consteval bool is_member_function_pointer(info type); -consteval bool is_enum(info type); -consteval bool is_union(info type); -consteval bool is_class(info type); -consteval bool is_function(info type);
2 [Example
-+// an example implementation -namespace std::meta { - consteval bool is_void(info type) { - return value_of<bool>(substitute(^is_void_v, {type})); - } -}
1 For any type
+T
, for each functionstd::meta::TRAIT
defined in this clause,std::meta::TRAIT(^T)
equals the value of the corresponding unary type traitstd::TRAIT_v<T>
as specified in 21.3.5.2 [meta.unary.cat].+consteval bool is_void(info type); +consteval bool is_null_pointer(info type); +consteval bool is_integral(info type); +consteval bool is_floating_point(info type); +consteval bool is_array(info type); +consteval bool is_pointer(info type); +consteval bool is_lvalue_reference(info type); +consteval bool is_rvalue_reference(info type); +consteval bool is_member_object_pointer(info type); +consteval bool is_member_function_pointer(info type); +consteval bool is_enum(info type); +consteval bool is_union(info type); +consteval bool is_class(info type); +consteval bool is_function(info type);
2 [Example
+// an example implementation +namespace std::meta { + consteval bool is_void(info type) { + return value_of<bool>(substitute(^is_void_v, {type})); + } +}
-end example]
++++1 For any type
+ +T
, for each functionstd::meta::TRAIT
defined in this clause,std::meta::TRAIT(^T)
equals the value of the corresponding unary type traitstd::TRAIT_v<T>
as specified in 21.3.5.3 [meta.unary.comp].
--1 For any type
-T
, for each functionstd::meta::TRAIT
defined in this clause,std::meta::TRAIT(^T)
equals the value of the corresponding unary type traitstd::TRAIT_v<T>
as specified in 21.3.5.3 [meta.unary.comp].+consteval bool is_reference(info type); -consteval bool is_arithmetic(info type); -consteval bool is_fundamental(info type); -consteval bool is_object(info type); -consteval bool is_scalar(info type); -consteval bool is_compound(info type); -consteval bool is_member_pointer(info type);
1 For any type
+T
, for each functionstd::meta::UNARY-TRAIT
defined in this clause with signaturebool(std::meta::info)
,std::meta::UNARY-TRAIT(^T)
equals the value of the corresponding type propertystd::UNARY-TRAIT_v<T>
as specified in 21.3.5.4 [meta.unary.prop].2 For any types
+T
andU
, for each functionstd::meta::BINARY-TRAIT
defined in this clause with signaturebool(std::meta::info, std::meta::info)
,std::meta::BINARY-TRAIT(^T, ^U)
equals the value of the corresponding type propertystd::BINARY-TRAIT_v<T, U>
as specified in 21.3.5.4 [meta.unary.prop].3 For any type
+T
and pack of typesU...
, for each functionstd::meta::VARIADIC-TRAIT
defined in this clause with signaturebool(std::meta::info, std::span<const std::meta::info>)
,std::meta::VARIADIC-TRAIT(^T, {^U...})
equals the value of the corresponding type propertystd::VARIADIC-TRAIT_v<T, U...>
as specified in 21.3.5.4 [meta.unary.prop].consteval bool is_const(info type); +consteval bool is_volatile(info type); +consteval bool is_trivial(info type); +consteval bool is_trivially_copyable(info type); +consteval bool is_standard_layout(info type); +consteval bool is_empty(info type); +consteval bool is_polymorphic(info type); +consteval bool is_abstract(info type); +consteval bool is_final(info type); +consteval bool is_aggregate(info type); +consteval bool is_signed(info type); +consteval bool is_unsigned(info type); +consteval bool is_bounded_array(info type); +consteval bool is_unbounded_array(info type); +consteval bool is_scoped_enum(info type); + +consteval bool is_constructible(info type, span<info const> type_args); +consteval bool is_default_constructible(info type); +consteval bool is_copy_constructible(info type); +consteval bool is_move_constructible(info type); + +consteval bool is_assignable(info dst_type, info src_type); +consteval bool is_copy_assignable(info type); +consteval bool is_move_assignable(info type); + +consteval bool is_swappable_with(info dst_type, info src_type); +consteval bool is_swappable(info type); + +consteval bool is_destructible(info type); + +consteval bool is_trivially_constructible(info type, span<info const> type_args); +consteval bool is_trivially_default_constructible(info type); +consteval bool is_trivially_copy_constructible(info type); +consteval bool is_trivially_move_constructible(info type); + +consteval bool is_trivially_assignable(info dst_type, info src_type); +consteval bool is_trivially_copy_assignable(info type); +consteval bool is_trivially_move_assignable(info type); +consteval bool is_trivially_destructible(info type); + +consteval bool is_nothrow_constructible(info type, span<info const> type_args); +consteval bool is_nothrow_default_constructible(info type); +consteval bool is_nothrow_copy_constructible(info type); +consteval bool is_nothrow_move_constructible(info type); + +consteval bool is_nothrow_assignable(info dst_type, info src_type); +consteval bool is_nothrow_copy_assignable(info type); +consteval bool is_nothrow_move_assignable(info type); + +consteval bool is_nothrow_swappable_with(info dst_type, info src_type); +consteval bool is_nothrow_swappable(info type); + +consteval bool is_nothrow_destructible(info type); + +consteval bool is_implicit_lifetime(info type); + +consteval bool has_virtual_destructor(info type); + +consteval bool has_unique_object_representations(info type); + +consteval bool reference_constructs_from_temporary(info dst_type, info src_type); +consteval bool reference_converts_from_temporary(info dst_type, info src_type);
--1 For any type
-T
, for each functionstd::meta::UNARY-TRAIT
defined in this clause with signaturebool(std::meta::info)
,std::meta::UNARY-TRAIT(^T)
equals the value of the corresponding type propertystd::UNARY-TRAIT_v<T>
as specified in 21.3.5.4 [meta.unary.prop].2 For any types
-T
andU
, for each functionstd::meta::BINARY-TRAIT
defined in this clause with signaturebool(std::meta::info, std::meta::info)
,std::meta::BINARY-TRAIT(^T, ^U)
equals the value of the corresponding type propertystd::BINARY-TRAIT_v<T, U>
as specified in 21.3.5.4 [meta.unary.prop].3 For any type
-T
and pack of typesU...
, for each functionstd::meta::VARIADIC-TRAIT
defined in this clause with signaturebool(std::meta::info, std::span<const std::meta::info>)
,std::meta::VARIADIC-TRAIT(^T, {^U...})
equals the value of the corresponding type propertystd::VARIADIC-TRAIT_v<T, U...>
as specified in 21.3.5.4 [meta.unary.prop].+consteval bool is_const(info type); -consteval bool is_volatile(info type); -consteval bool is_trivial(info type); -consteval bool is_trivially_copyable(info type); -consteval bool is_standard_layout(info type); -consteval bool is_empty(info type); -consteval bool is_polymorphic(info type); -consteval bool is_abstract(info type); -consteval bool is_final(info type); -consteval bool is_aggregate(info type); -consteval bool is_signed(info type); -consteval bool is_unsigned(info type); -consteval bool is_bounded_array(info type); -consteval bool is_unbounded_array(info type); -consteval bool is_scoped_enum(info type); - -consteval bool is_constructible(info type, span<info const> type_args); -consteval bool is_default_constructible(info type); -consteval bool is_copy_constructible(info type); -consteval bool is_move_constructible(info type); - -consteval bool is_assignable(info dst_type, info src_type); -consteval bool is_copy_assignable(info type); -consteval bool is_move_assignable(info type); - -consteval bool is_swappable_with(info dst_type, info src_type); -consteval bool is_swappable(info type); - -consteval bool is_destructible(info type); - -consteval bool is_trivially_constructible(info type, span<info const> type_args); -consteval bool is_trivially_default_constructible(info type); -consteval bool is_trivially_copy_constructible(info type); -consteval bool is_trivially_move_constructible(info type); - -consteval bool is_trivially_assignable(info dst_type, info src_type); -consteval bool is_trivially_copy_assignable(info type); -consteval bool is_trivially_move_assignable(info type); -consteval bool is_trivially_destructible(info type); - -consteval bool is_nothrow_constructible(info type, span<info const> type_args); -consteval bool is_nothrow_default_constructible(info type); -consteval bool is_nothrow_copy_constructible(info type); -consteval bool is_nothrow_move_constructible(info type); - -consteval bool is_nothrow_assignable(info dst_type, info src_type); -consteval bool is_nothrow_copy_assignable(info type); -consteval bool is_nothrow_move_assignable(info type); - -consteval bool is_nothrow_swappable_with(info dst_type, info src_type); -consteval bool is_nothrow_swappable(info type); - -consteval bool is_nothrow_destructible(info type); - -consteval bool is_implicit_lifetime(info type); - -consteval bool has_virtual_destructor(info type); - -consteval bool has_unique_object_representations(info type); - -consteval bool reference_constructs_from_temporary(info dst_type, info src_type); -consteval bool reference_converts_from_temporary(info dst_type, info src_type);
1 For any type
+T
, for each functionstd::meta::PROP
defined in this clause with signaturesize_t(std::meta::info)
,std::meta::PROP(^T)
equals the value of the corresponding type propertystd::PROP_v<T>
as specified in 21.3.6 [meta.unary.prop.query].2 For any type
+T
and unsigned integer valueI
,std::meta::extent(^T, I)
equalsstd::extent_v<T, I>
([meta.unary.prop.query]).
--1 For any type
-T
, for each functionstd::meta::PROP
defined in this clause with signaturesize_t(std::meta::info)
,std::meta::PROP(^T)
equals the value of the corresponding type propertystd::PROP_v<T>
as specified in 21.3.6 [meta.unary.prop.query].2 For any type
-T
and unsigned integer valueI
,std::meta::extent(^T, I)
equalsstd::extent_v<T, I>
([meta.unary.prop.query]).+consteval size_t alignment_of(info type); -consteval size_t rank(info type); -consteval size_t extent(info type, unsigned i = 0);
1 The consteval functions specified in this clause may be used to query relationships between types at compile time.
+2 For any types
+T
andU
, for each functionstd::meta::REL
defined in this clause with signaturebool(std::meta::info, std::meta::info)
,std::meta::REL(^T, ^U)
equals the value of the corresponding type relationstd::REL_v<T, U>
as specified in 21.3.7 [meta.rel].3 For any type
+T
and pack of typesU...
, for each functionstd::meta::VARIADIC-REL
defined in this clause with signaturebool(std::meta::info, std::span<const std::meta::info>)
,std::meta::VARIADIC-REL(^T, {^U...})
equals the value of the corresponding type relationstd::VARIADIC-REL_v<T, U...>
as specified in 21.3.7 [meta.rel].4 For any types
+T
andR
and pack of typesU...
, for each functionstd::meta::VARIADIC-REL-R
defined in this clause with signaturebool(std::meta::info, std::meta::info, std::span<const std::meta::info>)
,std::meta::VARIADIC-REL-R(^R, ^T, {^U...})
equals the value of the corresponding type relationstd::VARIADIC-REL-R_v<R, T, U...>
as specified in 21.3.7 [meta.rel].+consteval bool is_same(info type1, info type2); +consteval bool is_base_of(info base_type, info derived_type); +consteval bool is_convertible(info src_type, info dst_type); +consteval bool is_nothrow_convertible(info src_type, info dst_type); +consteval bool is_layout_compatible(info type1, info type2); +consteval bool is_pointer_interconvertible_base_of(info base_type, info derived_type); + +consteval bool is_invocable(info type, span<const info> type_args); +consteval bool is_invocable_r(info result_type, info type, span<const info> type_args); + +consteval bool is_nothrow_invocable(info type, span<const info> type_args); +consteval bool is_nothrow_invocable_r(info result_type, info type, span<const info> type_args);
5 [ Note 1: If
t
is a reflection of the typeint
andu
is a reflection of an alias to the typeint
, thent == u
isfalse
butis_same(t, u)
istrue
.t == dealias(u)
is alsotrue
. — end note ].
--1 For any types
-T
andU
, for each functionstd::meta::REL
defined in this clause with signaturebool(std::meta::info, std::meta::info)
,std::meta::REL(^T, ^U)
equals the value of the corresponding type relationstd::REL_v<T, U>
as specified in 21.3.7 [meta.rel].2 For any type
-T
and pack of typesU...
, for each functionstd::meta::VARIADIC-REL
defined in this clause with signaturebool(std::meta::info, std::span<const std::meta::info>)
,std::meta::VARIADIC-REL(^T, {^U...})
equals the value of the corresponding type relationstd::VARIADIC-REL_v<T, U...>
as specified in 21.3.7 [meta.rel].3 For any types
-T
andR
and pack of typesU...
, for each functionstd::meta::VARIADIC-REL-R
defined in this clause with signaturebool(std::meta::info, std::meta::info, std::span<const std::meta::info>)
,std::meta::VARIADIC-REL-R(^R, ^T, {^U...})
equals the value of the corresponding type relationstd::VARIADIC-REL-R_v<R, T, U...>
as specified in 21.3.7 [meta.rel].-consteval bool is_same(info type1, info type2); -consteval bool is_base_of(info base_type, info derived_type); -consteval bool is_convertible(info src_type, info dst_type); -consteval bool is_nothrow_convertible(info src_type, info dst_type); -consteval bool is_layout_compatible(info type1, info type2); -consteval bool is_pointer_interconvertible_base_of(info base_type, info derived_type); - -consteval bool is_invocable(info type, span<const info> type_args); -consteval bool is_invocable_r(info result_type, info type, span<const info> type_args); - -consteval bool is_nothrow_invocable(info type, span<const info> type_args); -consteval bool is_nothrow_invocable_r(info result_type, info type, span<const info> type_args);
4 [ Note 1: If
+t
is a reflection of the typeint
andu
is a reflection of an alias to the typeint
, thent == u
isfalse
butis_same(t, u)
istrue
.t == dealias(u)
is alsotrue
. — end note ].1 Subclause [meta.reflection.trans] contains consteval functions that may be used to transform one type to another following some predefined rule.
--1 For any type
-T
, for each functionstd::meta::MOD
defined in this clause,std::meta::MOD(^T)
returns the reflection of the corresponding typestd::MOD_t<T>
as specified in 21.3.8.2 [meta.trans.cv].+consteval info remove_const(info type); -consteval info remove_volatile(info type); -consteval info remove_cv(info type); -consteval info add_const(info type); -consteval info add_volatile(info type); -consteval info add_cv(info type);
1 For any type
+T
, for each functionstd::meta::MOD
defined in this clause,std::meta::MOD(^T)
returns the reflection of the corresponding typestd::MOD_t<T>
as specified in 21.3.8.2 [meta.trans.cv].
--1 For any type
-T
, for each functionstd::meta::MOD
defined in this clause,std::meta::MOD(^T)
returns the reflection of the corresponding typestd::MOD_t<T>
as specified in 21.3.8.3 [meta.trans.ref].+consteval info remove_reference(info type); -consteval info add_lvalue_reference(info type); -consteval info add_rvalue_reference(info type);
1 For any type
+T
, for each functionstd::meta::MOD
defined in this clause,std::meta::MOD(^T)
returns the reflection of the corresponding typestd::MOD_t<T>
as specified in 21.3.8.3 [meta.trans.ref].
--1 For any type
- +T
, for each functionstd::meta::MOD
defined in this clause,std::meta::MOD(^T)
returns the reflection of the corresponding typestd::MOD_t<T>
as specified in 21.3.8.4 [meta.trans.sign].1 For any type
+T
, for each functionstd::meta::MOD
defined in this clause,std::meta::MOD(^T)
returns the reflection of the corresponding typestd::MOD_t<T>
as specified in 21.3.8.4 [meta.trans.sign].
--1 For any type
- +T
, for each functionstd::meta::MOD
defined in this clause,std::meta::MOD(^T)
returns the reflection of the corresponding typestd::MOD_t<T>
as specified in 21.3.8.5 [meta.trans.arr].1 For any type
+T
, for each functionstd::meta::MOD
defined in this clause,std::meta::MOD(^T)
returns the reflection of the corresponding typestd::MOD_t<T>
as specified in 21.3.8.5 [meta.trans.arr].
--1 For any type
- +T
, for each functionstd::meta::MOD
defined in this clause,std::meta::MOD(^T)
returns the reflection of the corresponding typestd::MOD_t<T>
as specified in 21.3.8.6 [meta.trans.ptr].1 For any type
+T
, for each functionstd::meta::MOD
defined in this clause,std::meta::MOD(^T)
returns the reflection of the corresponding typestd::MOD_t<T>
as specified in 21.3.8.6 [meta.trans.ptr].
[ Editor's note: There are four transformations that are deliberately omitted here. type_identity
and enable_if
are not useful, conditional(cond, t, f)
would just be a long way of writing cond ? t : f
, and basic_common_reference
is a class template intended to be specialized and not directly invoked. ]
diff --git a/2996_reflection/reflection.md b/2996_reflection/reflection.md index 7ab69046..43186730 100644 --- a/2996_reflection/reflection.md +++ b/2996_reflection/reflection.md @@ -1828,6 +1828,16 @@ namespace std::meta { consteval info template_of(info r); consteval vector-1 For any type
-T
, for each functionstd::meta::MOD
defined in this clause with signaturestd::meta::info(std::meta::info)
,std::meta::MOD(^T)
returns the reflection of the corresponding typestd::MOD_t<T>
as specified in 21.3.8.7 [meta.trans.other].2 For any pack of types
-T...
, for each functionstd::meta::VARIADIC-MOD
defined in this clause with signaturestd::meta::info(std::span<const std::meta::info>)
,std::meta::VARIADIC-MOD({^T...})
returns the reflection of the corresponding typestd::VARIADIC-MOD_t<T...>
as specified in 21.3.8.7 [meta.trans.other].3 For any type
-T
and pack of typesU...
,std::meta::invoke_result(^T, {^u...})
returns the reflection of the corresponding typestd::invoke_result_t<T, U...>
(21.3.8.7 [meta.trans.other]).-consteval info remove_cvref(info type); -consteval info decay(info type); -consteval info common_type(span<const info> type_args); -consteval info common_reference(span<const info> type_args); -consteval info underlying_type(info type); -consteval info invoke_result(info type, span<const info> type_args); -consteval info unwrap_reference(info type); -consteval info unwrap_ref_decay(info type);
4 [Example:
-+// example implementation -consteval info unwrap_reference(info type) { - if (has_template_arguments(type) && template_of(type) == ^reference_wrapper) { - return add_lvalue_reference(template_arguments_of(type)[0]); - } else { - return type; - } -}
1 For any type
+T
, for each functionstd::meta::MOD
defined in this clause with signaturestd::meta::info(std::meta::info)
,std::meta::MOD(^T)
returns the reflection of the corresponding typestd::MOD_t<T>
as specified in 21.3.8.7 [meta.trans.other].2 For any pack of types
+T...
, for each functionstd::meta::VARIADIC-MOD
defined in this clause with signaturestd::meta::info(std::span<const std::meta::info>)
,std::meta::VARIADIC-MOD({^T...})
returns the reflection of the corresponding typestd::VARIADIC-MOD_t<T...>
as specified in 21.3.8.7 [meta.trans.other].3 For any type
+T
and pack of typesU...
,std::meta::invoke_result(^T, {^u...})
returns the reflection of the corresponding typestd::invoke_result_t<T, U...>
(21.3.8.7 [meta.trans.other]).+consteval info remove_cvref(info type); +consteval info decay(info type); +consteval info common_type(span<const info> type_args); +consteval info common_reference(span<const info> type_args); +consteval info underlying_type(info type); +consteval info invoke_result(info type, span<const info> type_args); +consteval info unwrap_reference(info type); +consteval info unwrap_ref_decay(info type);
4 [Example:
+// example implementation +consteval info unwrap_reference(info type) { + if (has_template_arguments(type) && template_of(type) == ^reference_wrapper) { + return add_lvalue_reference(template_arguments_of(type)[0]); + } else { + return type; + } +}
-end example]