std::experimental::invocation_type, std::experimental::raw_invocation_type
来自 cppreference.cn
< cpp | experimental
定义于头文件 <experimental/type_traits> |
||
template< class > struct raw_invocation_type; //undefined |
(1) | (library fundamentals TS) |
template< class > struct invocation_type; //undefined |
(2) | (library fundamentals TS) |
当使用参数 ArgTypes...
调用 Fn
时,计算调用参数,如 INVOKE(std::declval<Fn>(), std::declval<ArgTypes>()...),其中 INVOKE 是在 Callable 中定义的操作。
表达式 INVOKE(f, t1, t2, ..., tN) 的调用参数定义如下,其中 T1
是 t1
的(可能带有 cv 限定符的)类型,而 U1
在 t1
是左值时为 T1&
,否则为 T1&&
- 如果
f
是指向类T
的成员函数的指针,则调用参数为U1
,后跟f
的参数,这些参数与t2, ..., tN
匹配。 - 如果
N == 1
且f
是指向类T
的成员数据的指针,则调用参数为U1
。 - 如果
f
是类类型的对象,则调用参数是在f
的函数调用运算符和替代调用函数中,与参数t1, ..., tN
的最佳可行函数匹配的参数。 - 在所有其他情况下,调用参数是与
t1, ..., tN
匹配的f
的参数。
如果参数 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; |
(library fundamentals TS) | |
template< class T > using invocation_type_t = typename invocation_type<T>::type; |
(library fundamentals TS) | |
[编辑] 示例
本节尚不完整 原因:没有示例 |
[编辑] 参见
C++ 文档,关于 Reflection TS
|