命名空間
變體
動作

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

出自 cppreference.com
 
 
實驗性
技術規範
檔案系統函式庫 (filesystem TS)
函式庫基礎 (library fundamentals TS)
函式庫基礎 2 (library fundamentals TS v2)
函式庫基礎 3 (library fundamentals TS v3)
平行化擴充 (parallelism TS)
平行化擴充 2 (parallelism TS v2)
並行化擴充 (concurrency TS)
並行化擴充 2 (concurrency TS v2)
概念 (concepts TS)
範圍 (ranges TS)
反射 (reflection TS)
數學特殊函數 (special functions TR)
實驗性非 TS
模式匹配
線性代數
std::execution
合約
2D 圖形
 
 
定義於標頭檔 <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)

Fn 以參數 ArgTypes... 呼叫時,計算其呼叫參數(invocation parameters),如同 INVOKE(std::declval<Fn>(), std::declval<ArgTypes>()...),其中 INVOKE 是定義於 Callable(可呼叫物)中的操作。

表達式 INVOKE(f, t1, t2, ..., tN)呼叫參數定義如下,其中 T1t1 的型別(可能含有 cv 限定詞),若 t1 為左值則 U1T1&,否則為 T1&&

  • f 為類別 T 的成員函式指標,則呼叫參數為 U1 後接 f 中與 t2, ..., tN 相匹配的參數。
  • N == 1f 為類別 T 的成員資料指標,則呼叫參數為 U1
  • f 為類別型別的物件,則呼叫參數為在 f 的函式呼叫運算子與代理呼叫函式中,針對引數 t1, ..., tN 的最佳可行函式所匹配的參數。
  • 在所有其他情況下,呼叫參數為 f 中與 t1, ..., tN 相匹配的參數。

若引數 tI 匹配函式參數列表中的省略號(ellipsis),則對應的呼叫參數為將預設引數提升應用於 tI 後的結果。

FnArgTypes 中的所有型別皆可為任何完整型別、未知邊界的陣列,或(可能含有 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;
(函式庫基礎 TS)
template< class T >
using invocation_type_t = typename invocation_type<T>::type;
(函式庫基礎 TS)

[編輯] 範例

[編輯] 參閱

C++ 文件 關於 Reflection TS
English Deutsch 日本語 中文(简体) 中文(繁體)