如何将旧版c ++函数转换为模板

时间:2017-10-01 23:52:54

标签: c++

假设我有一堆旧的c ++函数,它们的函数名和返回类型都有数据类型:

type_float func_float (float a, float b) { ... }
type_double func_double (double a, double b) {...}
type_int func_int (int a, int b) {...}
...

现在我想使用c ++模板为这些函数添加一个包装器,如:

template<return_type, input_type> 
return_type func(input_type a, input_type b) 

在这个模板函数中,我必须根据输入类型使用那些现有的遗留函数。是否有可能在c ++中实现这一点?

0 个答案:

没有答案