R operator()(ArgTypes... args) const noexcept(/*noex*/);
概要
関数を呼び出す。
operator()
のnoexcept例外指定 noex は、function_ref
に指定するテンプレートパラメータR(ArgTypes...)
部のものと等しい。
効果
以下と等価。参照対象に応じた詳細仕様はコンストラクタ説明を参照のこと。
return thunk-ptr(bound-entity, std::forward<ArgTypes>(args)...);
戻り値
R
型がvoid
の場合は何も返さない。そうでなければ、関数呼び出しの戻り値を返す。
例
#include <iostream>
#include <functional>
int ident(int x)
{ return x; }
int main()
{
std::function_ref<int(int)> f = ident;
// 関数呼び出し : 参照しているident()関数を呼び出す
int result = f(1);
std::cout << result << std::endl;
}
xxxxxxxxxx
#include <iostream>
#include <functional>
int ident(int x)
{ return x; }
int main()
{
std::function_ref<int(int)> f = ident;
// 関数呼び出し : 参照しているident()関数を呼び出す
int result = f(1);
std::cout << result << std::endl;
}
出力
1
バージョン
言語
- C++26
処理系
- Clang: ??
- GCC: ??
- ICC: ??
- Visual C++: ??