调用函数不同参数以及返回值
来源:互联网 发布:linux 清空回收站 编辑:程序博客网 时间:2024/04/30 05:10
template<typename T>
class CTC
{
public:
CTC(std::function<T> f)
{
fu = f;
}
template<typename...Args>
void Exec(Args&&...args)
{
fu(std::forward < Args>(args)...);
}
private:
std::function<T> fu;
};
void Test1()
{
std::cout << "test1" << endl;
}
void Test2(int a)
{
std::cout << "test1" <<a<< endl;
}
int Test3(int a,int b)
{
return 0;
}
int main()
{
CTC<int(int,int)> t(Test3);
t.Exec(1,2);
class CTC
{
public:
CTC(std::function<T> f)
{
fu = f;
}
template<typename...Args>
void Exec(Args&&...args)
{
fu(std::forward < Args>(args)...);
}
private:
std::function<T> fu;
};
void Test1()
{
std::cout << "test1" << endl;
}
void Test2(int a)
{
std::cout << "test1" <<a<< endl;
}
int Test3(int a,int b)
{
return 0;
}
int main()
{
CTC<int(int,int)> t(Test3);
t.Exec(1,2);
getchar();
}
0 0
- 调用函数不同参数以及返回值
- x64 调用约定,参数传递以及函数返回值
- open函数参数以及返回值详解
- 函数定义,调用,参数,返回值
- 生成dll文件以及python对DLL中函数的调用(参数类型以及返回值)
- dwr 3.0 配置 + 不同参数,不同返回值调用方法 示例
- 二维数组作函数参数以及返回值
- 函数的参数以及返回值,局部变量
- 案例:Python将函数作为参数以及作为返回值
- 引用作为函数参数以及返回值的好处
- windbg查看函数参数,调用堆栈,及返回值.
- X86和ARM:函数调用参数传递和返回值
- 函数调用中参数和返回值的拷贝
- Shell函数:Shell函数返回值、删除函数、在终端调用函数 函数参数
- 调用函数返回值
- JavaScript-4.3函数的参数和返回值,参数数目不确定的函数调用---ShinePans
- Swift 2.0 函数 定义、调用、参数返回值、函数类型、嵌套函数
- 只能靠参数而不能靠返回值类型的不同来区分重载函数
- play框架用起来(2)
- ELF格式文件和BIN文件的区别
- 用C语言完成冒泡排序
- foreService
- cookie中存中文
- 调用函数不同参数以及返回值
- 微服务的可变和不可变
- C++学习摘要3
- 托盘操作
- ejabberd为游戏免除注册限制
- ELF文件和BIN文件
- Leetcode-152. Maximum Product Subarray
- Android中的四大组件
- stosd,stosb,stosw汇编指令