std::experimental::invocation_type, std::experimental::raw_invocation_type
来自cppreference.com
< cpp | experimental
| 定义于头文件 <experimental/type_traits>
|
||
| template<class> struct raw_invocation_type; // 不定义 |
(1) | (库基础 TS) |
| template<class> struct invocation_type; // 不定义 |
(2) | (库基础 TS) |
在以参数 ArgTypes... 调用 Fn ,如在 INVOKE(std::declval<Fn>(), std::declval<ArgTypes>()...) 中时计算调用形参,其中 INVOKE 是 可调用 (Callable) 中定义的操作。
表达式 INVOKE(f, t1, t2, ..., tN) 的调用形参定义如下,其中 T1 是(可有 cv 限定的) t1 的类型,而若 t1 为左值则 U1 为 T1& ,否则为 T1&& :
- 若
f是指向类T成员函数的指针,则调用参数是U1后随t2, ..., tN所匹配的f的形参。 - 若
N == 1且f为指向类T数据成员的指针,则调用形参为U1。 - 若
f为类类型对象,则调用形参为在f的代理调用函数和函数调用运算符间,实参t1, ..., tN的最佳可达函数的匹配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) | |
示例
| 本节未完成 原因:暂无示例 |