问题描述
我正在使用C ++98。是否可以在模板中将模板声明为类型?
这样做时,我得到以下错误。
#include<iostream>
#include<vector>
#include<map>
// below template declaration is in my header file
template <typename T> void function (T a,std::map<int,T> & val) // error 2782 Template parameter T is
// unambiguous
{
std::cout<< a;
// some computations on the map
}
int main()
{
std::map<int,std::vector<double>> mp_map;
mp_map[0].push_back(1.0);
mp_map[0].push_back(2.0);
function(0.0,mp_map);
return 0;
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)