Namespaces
Variants

std::experimental:: invocation_type, std::experimental:: raw_invocation_type

From cppreference.net
定义于头文件 <experimental/type_traits>
template < class >

struct raw_invocation_type ; //未定义

template < class Fn, class ... ArgTypes >

struct raw_invocation_type < Fn ( ArgTypes... ) > ;
(1) (库基础TS)
template < class >

struct invocation_type ; //未定义

template < class Fn, class ... ArgTypes >

struct invocation_type < Fn ( ArgTypes... ) > ;
(2) (库基础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 后接由 t2, ..., tN 匹配的 f 参数。
  • 如果 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, ... ) ,其中:

仅当 Fn 能在未求值上下文中通过参数 ArgTypes... 调用时定义。

invocation_type < Fn ( ArgTypes... ) > :: type R ( U1, U2, ... ) ,其中

仅当 Fn 能在未求值上下文中通过参数 ArgTypes... 调用时定义。

辅助类型

template < class T >
using raw_invocation_type_t = typename raw_invocation_type < T > :: type ;
(库基础技术规范)
template < class T >
using invocation_type_t = typename invocation_type < T > :: type ;
(库基础技术规范)

示例

参见

C++ 文档 关于 Reflection TS