std::experimental::invocation_type, std::experimental::raw_invocation_type
来自 cppreference.cn
定义于头文件 <experimental/type_traits> |
||
template< class > struct raw_invocation_type; //未定义 |
(1) | (库基础 TS) |
template< class > struct invocation_type; //未定义 |
(2) | (库基础 TS) |
计算当 Fn
与参数 ArgTypes...
一起调用时的*调用参数*,如 INVOKE(std::declval<Fn>(), std::declval<ArgTypes>()...),其中 INVOKE 是在 Callable 中定义的操作。
表达式 INVOKE(f, t1, t2, ..., tN) 的*调用参数*定义如下,其中 T1
是 t1
的(可能是 cv-限定的)类型,如果 t1
是左值,则 U1
是 T1&
,否则是 T1&&
。
- 如果
f
是类T
的成员函数指针,则调用参数为U1
,后跟由t2, ..., tN
匹配的f
的参数。 - 如果
N == 1
且f
是类T
的成员数据指针,则调用参数为U1
。 - 如果
f
是类类型对象,则调用参数是在f
的函数调用运算符和代理调用函数中,与参数t1, ..., tN
匹配的最佳可行函数的参数。 - 在所有其他情况下,调用参数是
f
的参数中与t1, ..., tN
匹配的参数。
如果参数 tI
与函数参数列表中的省略号匹配,则相应的调用参数是对 tI
应用默认参数提升的结果。
Fn
和 ArgTypes
中的所有类型可以是任何完整类型、未知边界数组或(可能是 cv-限定的)void
。
目录 |
[编辑] 成员类型
成员类型 | 定义 |
raw_invocation_type<Fn(ArgTypes...)>::type | R(T1, T2, ...),其中
仅当 |
invocation_type<Fn(ArgTypes...)>::type | R(U1, U2, ...),其中
仅当 |
[编辑] 辅助类型
template< class T > using raw_invocation_type_t = typename raw_invocation_type<T>::type; |
(库基础 TS) | |
template< class T > using invocation_type_t = typename invocation_type<T>::type; |
(库基础 TS) | |
[编辑] 示例
本节不完整 原因:无示例 |
[编辑] 另请参阅
C++ 文档,关于 反射 TS
|