实验性库头文件 <experimental/reflect>
来自cppreference.com
此头文件是反射 TS 的一部分。
在命名空间
std::experimental::reflect 定义 | |
在内联命名空间
std::experimental::reflect::v1 定义 | |
目录
概念 | |
(反射 TS) |
指定类型为元对象类型 (概念) |
(反射 TS) |
指定元对象类型为元对象序列类型 (概念) |
(反射 TS) |
指定元对象类型反射模板形参作用域 (概念) |
(反射 TS) |
指定元对象类型反射具有关联(可能为空的)名字的实体 (概念) |
(反射 TS) |
指定元对象类型反射类型别名、命名空间别名或由 using 声明引入的别名 (概念) |
(反射 TS) |
指定元对象类型反射类的 成员声明 (概念) |
(反射 TS) |
指定元对象类型反射枚举项 (概念) |
(反射 TS) |
指定元对象类型反射变量或数据成员 (概念) |
(反射 TS) |
指定元对象类型满足 RecordMember、Enumerator 或 Variable,或反射全局命名空间以外的命名空间 (概念) |
(反射 TS) |
指定元对象类型反射具有类型的实体 (概念) |
(反射 TS) |
指定元对象类型反射命名空间 (概念) |
(反射 TS) |
指定元对象类型反射全局命名空间 (概念) |
(反射 TS) |
指定元对象类型反射非联合体类类型 (概念) |
(反射 TS) |
指定元对象类型反射枚举类型 (概念) |
(反射 TS) |
指定元对象类型反射类类型 (概念) |
(反射 TS) |
指定元对象类型反射命名空间、类、枚举、闭包类型、模板实参作用域 (概念) |
(反射 TS) |
指定元对象类型反射一个类型 (概念) |
(反射 TS) |
指定元对象类型反射枚举项或 constexpr 变量 (概念) |
(反射 TS) |
指定元对象类型反射从 get_base_classes 获得的直接基类 (概念) |
(反射 TS) |
指定元对象类型反射模板形参 (概念) |
(反射 TS) |
指定元对象类型反射函数(包括构造函数与析构函数) (概念) |
(反射 TS) |
指定元对象类型反射表达式 (概念) |
(反射 TS) |
指定元对象类型反射有括号表达式 (概念) |
(反射 TS) |
指定元对象类型反射 函数调用表达式 (概念) |
(反射 TS) |
指定元对象类型反射 函数式类型转换表达式 (概念) |
(反射 TS) |
指定元对象类型反射函数(不含构造函数与析构函数) (概念) |
(反射 TS) |
指定元对象类型反射成员函数I(不含构造函数与析构函数) (概念) |
(反射 TS) |
指定元对象类型反射特殊成员函数 (概念) |
(反射 TS) |
指定元对象类型反射构造函数 (概念) |
(反射 TS) |
指定元对象类型反射析构函数 (概念) |
(反射 TS) |
指定元对象类型反射运算符函数或转换函数 (概念) |
(反射 TS) |
指定元对象类型反射转换函数 (概念) |
(反射 TS) |
指定元对象类型反射非泛型 lambda 的闭包类型 (概念) |
(反射 TS) |
指定元对象类型反射 lambda 捕获 (概念) |
类 | |
| |
(反射 TS) |
检查两个元对象类型是否反射同一实体或别名 (类模板) |
(反射 TS) |
获得被反射实体或别名的声明的预设行号 (类模板) |
(反射 TS) |
获得被反射实体或别名的声明的实现定义列号 (类模板) |
(反射 TS) |
获得被反射实体或别名的声明的预设文件名 (类模板) |
| |
(反射 TS) |
获得元对象序列的大小 (类模板) |
(反射 TS) |
获得元对象序列中拥有给定下标的元对象类型 (类模板) |
(反射 TS) |
应用模板到元对象序列 (类模板) |
| |
(反射 TS) |
检查被反射实体或别名是否为无名 (类模板) |
(反射 TS) |
获得被反射实体或别名的无限定名 (类模板) |
(反射 TS) |
获得被反射实体或别名的实现定义显示名 (类模板) |
| |
(反射 TS) |
获得反射被反射别名的关联实体的元对象类型 (类模板) |
| |
(反射 TS) |
获得反射被反射实体或别名的类型的元对象类型 (类模板) |
(反射 TS) |
获得反射被反射实体或别名的类型 (类模板) |
(反射 TS) |
检查元对象类型是否反射枚举类型 (类模板) |
(反射 TS) |
检查元对象类型是否反射联合体类型 (类模板) |
分别检查元对象类型是否反射声明使用 class 或 struct 的非联合类类型 (类模板) | |
| |
(反射 TS) |
获得反射被反射实体或别名的作用域的元对象类型 (类模板) |
| |
(反射 TS) |
获得反射给定基类关系中基类的元对象类型 (类模板) |
| |
(反射 TS) |
检查被反射的成员或基类是否为公开 (类模板) |
(反射 TS) |
检查被反射的成员或基类是否为受保护 (类模板) |
(反射 TS) |
检查被反射的成员或基类是否为私有 (类模板) |
| |
| 获得元素反射被反射类的公开、可访问或全部数据成员的元对象序列类型 (类模板) | |
| 获得元素反射被反射类的公开、可访问或全部成员函数的元对象序列类型 (类模板) | |
(反射 TS) |
获得元素反射被反射类的全部构造函数的的元对象序列类型 (类模板) |
(反射 TS) |
获得元素反射声明于被反射类中的所有运算符函数及转换函数的的元对象序列类型 (类模板) |
(反射 TS) |
获得反射被反射类的析构函数的元对象类型 (类模板) |
| 获得元素反射被反射类的公开、可访问或全部成员类型的元对象序列类型 (类模板) | |
| 获得元素反射被反射类的公开、可访问或全部基类的元对象序列类型 (类模板) | |
| |
(反射 TS) |
检查被反射枚举是否有作用域 (类模板) |
(反射 TS) |
获得元素反射被反射枚举的枚举项的元对象序列类型 (类模板) |
(反射 TS) |
获得反射被反射枚举的底层类型的元对象类型 (类模板) |
| |
(反射 TS) |
获得作为常量表达式的被反射变量的值 (类模板) |
(反射 TS) |
检查变量是否声明带 thread_local (类模板) |
| |
(反射 TS) |
检查被反射的形参是否有默认实参 (类模板) |
| |
(反射 TS) |
获得元素反射被反射函数的形参的元对象序列类型 (类模板) |
(反射 TS) |
检查被反射函数的形参列表是否含有省略号形参 (类模板) |
(反射 TS) |
检查被反射函数是否为不抛出 (类模板) |
(反射 TS) |
检查被反射函数是否为被弃置 (类模板) |
| |
(反射 TS) |
检查被反射变量或函数是否为 constexpr (类模板) |
| |
(反射 TS) |
检查被反射的命名空间或函数是否为 inline (类模板) |
| |
(反射 TS) |
获得反射被反射的有括号表达式的无括号表达式的元对象类型 (类模板) |
| |
(反射 TS) |
获得反射被反射的 函数调用表达式 中的函数的元对象类型 (类模板) |
| |
(反射 TS) |
获得反射被反射的 函数式类型转换表达式 中的构造函数的元对象类型 (类模板) |
| |
(反射 TS) |
获得被反射变量或函数的地址,或指向非静态成员的成员指针值 (类模板) |
| |
分别检查被反射成员函数是否声明带 const、volatile、& 或 && 限定符 (类模板) | |
(反射 TS) |
检查被反射的成员函数是否重写基类的成员函数 (类模板) |
| |
(反射 TS) |
检查被反射的类或成员函数是否标记为 final (类模板) |
| |
(反射 TS) |
检查被反射的变量是否拥有静态存储期,或被反射的成员函数是否为静态 (类模板) |
| |
(反射 TS) |
检查被反射的特殊成员函数是否为隐式声明 (类模板) |
(反射 TS) |
检查被反射的成员函数是否在其首条声明预置 (类模板) |
| |
(反射 TS) |
检查被反射的构造函数或转换函数是否声明带 explicit (类模板) |
| |
(反射 TS) |
检查被反射的成员函数是否为虚 (类模板) |
(反射 TS) |
检查被反射的成员函数是否为纯虚 (类模板) |
| |
(反射 TS) |
获得元素反射被反射闭包类型的捕获的元对象序列类型 (类模板) |
分别检查被反射闭包类型的 lambda 表达式的捕获默认是否为 = 或 & (类模板) | |
(反射 TS) |
检查被反射闭包类型的 operator() 是否声明带 const (类模板) |
| |
(反射 TS) |
检查被反射的 lambda 捕获是否被显式捕获 (类模板) |
(反射 TS) |
检查被反射的 lambda 捕获是否为初始化捕获 (类模板) |
概要
namespace std::experimental::reflect {
inline namespace v1 {
// 21.12.3 元对象类型的概念
template <class T>
concept Object = /* 见描述 */;
template <class T>
concept ObjectSequence = /* 见描述 */; // 细化 Object
template <class T>
concept TemplateParameterScope = /* 见描述 */; // 细化 Scope
template <class T>
concept Named = /* 见描述 */; // 细化 Object
template <class T>
concept Alias = /* 见描述 */; // 细化 Named 与 ScopeMember
template <class T>
concept RecordMember = /* 见描述 */; // 细化 ScopeMember
template <class T>
concept Enumerator = /* 见描述 */; // 细化 Constant
template <class T>
concept Variable = /* 见描述 */; // 细化 Typed 与 ScopeMember
template <class T>
concept ScopeMember = /* 见描述 */; // 细化 Named
template <class T>
concept Typed = /* 见描述 */; // 细化 Object
template <class T>
concept Namespace = /* 见描述 */; // 细化 Named 与 Scope
template <class T>
concept GlobalScope = /* 见描述 */; // 细化 Namespace
template <class T>
concept Class = /* 见描述 */; // 细化 Record
template <class T>
concept Enum = /* 见描述 */; // 细化 Type, Scope, 与 ScopeMember
template <class T>
concept Record = /* 见描述 */; // 细化 Type, Scope, 与 ScopeMember
template <class T>
concept Scope = /* 见描述 */; // 细化 Object
template <class T>
concept Type = /* 见描述 */; // 细化 Named
template <class T>
concept Constant = /* 见描述 */; // 细化 Typed 与 ScopeMember
template <class T>
concept Base = /* 见描述 */; // 细化 Object
template <class T>
concept FunctionParameter = /* 见描述 */; // 细化 Typed 与 ScopeMember
template <class T>
concept Callable = /* 见描述 */; // 细化 Scope 与 ScopeMember
template <class T>
concept Expression = /* 见描述 */; // 细化 Object
template <class T>
concept ParenthesizedExpression = /* 见描述 */; // 细化 Expression
template <class T>
concept FunctionCallExpression = /* 见描述 */; // 细化 Expression
template <class T>
concept FunctionalTypeConversion = /* 见描述 */; // 细化 Expression
template <class T>
concept Function = /* 见描述 */; // 细化 Typed 与 Callable
template <class T>
concept MemberFunction = /* 见描述 */; // 细化 RecordMember 与 Function
template <class T>
concept SpecialMemberFunction = /* 见描述 */; // 细化 RecordMember
template <class T>
concept Constructor = /* 见描述 */; // 细化 Callable 与 RecordMember
template <class T>
concept Destructor = /* 见描述 */; // 细化 Callable 与 SpecialMemberFunction
template <class T>
concept Operator = /* 见描述 */; // 细化 Function
template <class T>
concept ConversionOperator = /* 见描述 */; // 细化 MemberFunction 与 Operator
template <class T>
concept Lambda = /* 见描述 */; // 细化 Type 与 Scope
template <class T>
concept LambdaCapture = /* 见描述 */; // 细化 Variable
// 21.12.4 元对象操作
// 多重概念操作
template <Object T> struct is_public;
template <Object T> struct is_protected;
template <Object T> struct is_private;
template <Object T> struct is_constexpr;
template <Object T> struct is_static;
template <Object T> struct is_final;
template <Object T> struct is_explicit;
template <Object T> struct is_inline;
template <Object T> struct is_virtual;
template <Object T> struct is_pure_virtual;
template <Object T> struct get_pointer;
template <class T>
requires RecordMember<T> || Base<T>
constexpr auto is_public_v = is_public<T>::value;
template <class T>
requires RecordMember<T> || Base<T>
constexpr auto is_protected_v = is_protected<T>::value;
template <class T>
requires RecordMember<T> || Base<T>
constexpr auto is_private_v = is_private<T>::value;
template <class T>
requires Variable<T> || Callable<T>
constexpr auto is_constexpr_v = is_constexpr<T>::value;
template <class T>
requires Variable<T> || MemberFunction<T>
constexpr auto is_static_v = is_static<T>::value;
template <class T>
requires Class<T> || MemberFunction<T>
constexpr auto is_final_v = is_final<T>::value;
template <class T>
requires Constructor<T> || ConversionOperator<T>
constexpr auto is_explicit_v = is_explicit<T>::value;
template <class T>
requires Namespace<T> || Callable<T>
constexpr auto is_inline_v = is_inline<T>::value;
template <class T>
requires Base<T> || MemberFunction<T> || Destructor<T>
constexpr auto is_virtual_v = is_virtual<T>::value;
template <class T>
requires MemberFunction<T> || Destructor<T>
constexpr auto is_pure_virtual_v = is_pure_virtual<T>::value;
template <class T>
requires Variable<T> || Function<T>
constexpr auto get_pointer_v = get_pointer<T>::value;
// 21.12.4.1 Object 操作
template <Object T1, Object T2> struct reflects_same;
template <Object T> struct get_source_line;
template <Object T> struct get_source_column;
template <Object T> struct get_source_file_name;
template <Object T1, Object T2>
constexpr auto reflects_same_v = reflects_same<T1, T2>::value;
template <class T>
constexpr auto get_source_line_v = get_source_line<T>::value;
template <class T>
constexpr auto get_source_column_v = get_source_column<T>::value;
template <class T>
constexpr auto get_source_file_name_v = get_source_file_name<T>::value;
// 21.12.4.2 ObjectSequence 操作
template <ObjectSequence T> struct get_size;
template <size_t I, ObjectSequence T> struct get_element;
template <template <class...> class Tpl, ObjectSequence T>
struct unpack_sequence;
template <ObjectSequence T>
constexpr auto get_size_v = get_size<T>::value;
template <size_t I, ObjectSequence T>
using get_element_t = typename get_element<I, T>::type;
template <template <class...> class Tpl, ObjectSequence T>
using unpack_sequence_t = typename unpack_sequence<Tpl, T>::type;
// 21.12.4.3 Named 操作
template <Named T> struct is_unnamed;
template <Named T> struct get_name;
template <Named T> struct get_display_name;
template <Named T>
constexpr auto is_unnamed_v = is_unnamed<T>::value;
template <Named T>
constexpr auto get_name_v = get_name<T>::value;
template <Named T>
constexpr auto get_display_name_v = get_display_name<T>::value;
// 21.12.4.4 Alias 操作
template <Alias T> struct get_aliased;
template <Alias T>
using get_aliased_t = typename get_aliased<T>::type;
// 21.12.4.5 Type 操作
template <Typed T> struct get_type;
template <Type T> struct get_reflected_type;
template <Type T> struct is_enum;
template <Class T> struct uses_class_key;
template <Class T> struct uses_struct_key;
template <Type T> struct is_union;
template <Typed T>
using get_type_t = typename get_type<T>::type;
template <Type T>
using get_reflected_type_t = typename get_reflected_type<T>::type;
template <Type T>
constexpr auto is_enum_v = is_enum<T>::value;
template <Class T>
constexpr auto uses_class_key_v = uses_class_key<T>::value;
template <Class T>
constexpr auto uses_struct_key_v = uses_struct_key<T>::value;
template <Type T>
constexpr auto is_union_v = is_union<T>::value;
// 21.12.4.6 Member 操作
template <ScopeMember T> struct get_scope;
template <RecordMember T> struct is_public<T>;
template <RecordMember T> struct is_protected<T>;
template <RecordMember T> struct is_private<T>;
template <ScopeMember T>
using get_scope_t = typename get_scope<T>::type;
// 21.12.4.7 Record 操作
template <Record T> struct get_public_data_members;
template <Record T> struct get_accessible_data_members;
template <Record T> struct get_data_members;
template <Record T> struct get_public_member_functions;
template <Record T> struct get_accessible_member_functions;
template <Record T> struct get_member_functions;
template <Record T> struct get_public_member_types;
template <Record T> struct get_accessible_member_types;
template <Record T> struct get_member_types;
template <Record T> struct get_constructors;
template <Record T> struct get_destructor;
template <Record T> struct get_operators;
template <Class T> struct get_public_base_classes;
template <Class T> struct get_accessible_base_classes;
template <Class T> struct get_base_classes;
template <Class T> struct is_final<T>;
template <Record T>
using get_public_data_members_t = typename get_public_data_members<T>::type;
template <Record T>
using get_accessible_data_members_t = typename get_accessible_data_members<T>::type;
template <Record T>
using get_data_members_t = typename get_data_members<T>::type;
template <Record T>
using get_public_member_functions_t = typename get_public_member_functions<T>::type;
template <Record T>
using get_accessible_member_functions_t = typename get_accessible_member_functions<T>::type;
template <Record T>
using get_member_functions_t = typename get_member_functions<T>::type;
template <Record T>
using get_public_member_types_t = typename get_public_member_types<T>::type;
template <Record T>
using get_accessible_member_types_t = typename get_accessible_member_types<T>::type;
template <Record T>
using get_member_types_t = typename get_member_types<T>::type;
template <Record T>
using get_constructors_t = typename get_constructors<T>::type;
template <Record T>
using get_destructor_t = typename get_destructor<T>::type;
template <Record T>
using get_operators_t = typename get_operators<T>::type;
template <Class T>
using get_public_base_classes_t = typename get_public_base_classes<T>::type;
template <Class T>
using get_accessible_base_classes_t = typename get_accessible_base_classes<T>::type;
template <Class T>
using get_base_classes_t = typename get_base_classes<T>::type;
// 21.12.4.8 Enum 操作
template <Enum T> struct is_scoped_enum;
template <Enum T> struct get_enumerators;
template <Enum T> struct get_underlying_type;
template <Enum T>
constexpr auto is_scoped_enum_v = is_scoped_enum<T>::value;
template <Enum T>
using get_enumerators_t = typename get_enumerators<T>::type;
template <Enum T>
using get_underlying_type_t = typename get_underlying_type<T>::type;
// 21.12.4.9 Value 操作
template <Constant T> struct get_constant;
template <Variable T> struct is_constexpr<T>;
template <Variable T> struct is_static<T>;
template <Variable T> struct is_thread_local;
template <Variable T> struct get_pointer<T>;
template <Constant T>
constexpr auto get_constant_v = get_constant<T>::value;
template <Variable T>
constexpr auto is_thread_local_v = is_thread_local<T>::value;
// 21.12.4.10 Base 操作
template <Base T> struct get_class;
template <Base T> struct is_virtual<T>;
template <Base T> struct is_public<T>;
template <Base T> struct is_protected<T>;
template <Base T> struct is_private<T>;
template <Base T>
using get_class_t = typename get_class<T>::type;
// 21.12.4.11 Namespace 操作
template <Namespace T> struct is_inline<T>;
// 21.12.4.12 FunctionParameter 操作
template <FunctionParameter T> struct has_default_argument;
template <FunctionParameter T>
constexpr auto has_default_argument_v = has_default_argument<T>::value;
// 21.12.4.13 Callable 操作
template <Callable T> struct get_parameters;
template <Callable T> struct is_vararg;
template <Callable T> struct is_constexpr<T>;
template <Callable T> struct is_noexcept;
template <Callable T> struct is_inline<T>;
template <Callable T> struct is_deleted;
template <Callable T>
using get_parameters_t = typename get_parameters<T>::type;
template <Callable T>
constexpr auto is_vararg_v = is_vararg<T>::value;
template <Callable T>
constexpr auto is_deleted_v = is_deleted<T>::value;
// 21.12.4.14 ParenthesizedExpression 操作
template <ParenthesizedExpression T> struct get_subexpression;
template <ParenthesizedExpression T>
using get_subexpression_t = typename get_subexpression<T>::type;
// 21.12.4.15 FunctionCallExpression 操作
template <FunctionCallExpression T> struct get_callable;
template <FunctionCallExpression T>
using get_callable_t = typename get_callable<T>::type;
// 21.12.4.16 FunctionalTypeConversion 操作
template <FunctionalTypeConversion T> struct get_constructor;
template <FunctionalTypeConversion T>
using get_constructor_t = typename get_constructor<T>::type;
// 21.12.4.17 Function 操作
template <Function T> struct get_pointer<T>;
// 21.12.4.18 MemberFunction 操作
template <MemberFunction T> struct is_static<T>;
template <MemberFunction T> struct is_const;
template <MemberFunction T> struct is_volatile;
template <MemberFunction T> struct has_lvalueref_qualifier;
template <MemberFunction T> struct has_rvalueref_qualifier;
template <MemberFunction T> struct is_virtual<T>;
template <MemberFunction T> struct is_pure_virtual<T>;
template <MemberFunction T> struct is_override;
template <MemberFunction T> struct is_final<T>;
template <MemberFunction T>
constexpr auto is_const_v = is_const<T>::value;
template <MemberFunction T>
constexpr auto is_volatile_v = is_volatile<T>::value;
template <MemberFunction T>
constexpr auto has_lvalueref_qualifier_v = has_lvalueref_qualifier<T>::value;
template <MemberFunction T>
constexpr auto has_rvalueref_qualifier_v = has_rvalueref_qualifier<T>::value;
template <MemberFunction T>
constexpr auto is_override_v = is_override<T>::value;
// 21.12.4.19 SpecialMemberFunction 操作
template <SpecialMemberFunction T> struct is_implicitly_declared;
template <SpecialMemberFunction T> struct is_defaulted;
template <SpecialMemberFunction T>
constexpr auto is_implicitly_declared_v = is_implicitly_declared<T>::value;
template <SpecialMemberFunction T>
constexpr auto is_defaulted_v = is_defaulted<T>::value;
// 21.12.4.20 Constructor 操作
template <Constructor T> struct is_explicit<T>;
// 21.12.4.21 Destructor 操作
template <Destructor T> struct is_virtual<T>;
template <Destructor T> struct is_pure_virtual<T>;
// 21.12.4.22 ConversionOperator 操作
template <ConversionOperator T> struct is_explicit<T>;
// 21.12.4.23 Lambda 操作
template <Lambda T> struct get_captures;
template <Lambda T> struct uses_default_copy_capture;
template <Lambda T> struct uses_default_reference_capture;
template <Lambda T> struct is_call_operator_const;
template <Lambda T>
using get_captures_t = typename get_captures<T>::type;
template <Lambda T>
constexpr auto uses_default_copy_capture_v = uses_default_copy_capture<T>::value;
template <Lambda T>
constexpr auto uses_default_reference_capture_v = uses_default_reference_capture<T>::value;
template <Lambda T>
constexpr auto is_call_operator_const_v = is_call_operator_const<T>::value;
// 21.12.4.24 LambdaCapture 操作
template <LambdaCapture T> struct is_explicitly_captured;
template <LambdaCapture T> struct is_init_capture;
template <LambdaCapture T>
constexpr auto is_explicitly_captured_v = is_explicitly_captured<T>::value;
template <LambdaCapture T>
constexpr auto is_init_capture_v = is_init_capture<T>::value;
} // inline namespace v1
} // namespace std::experimental::reflect