帮我看看下面的函数代码,有什么问题?谢谢了
rwq_ 2003-10-07 11:34:49 int comp(const int arg1,const int arg2)
{
if(arg1 == arg2)
return 0;
else if(arg1 > arg2)
return 1;
else
return -1;
}
template <typename Type, int (*Comp)(const Type&, const Type&)>
const Type& min( const Type *p, int size, Comp comp)//这行出现错误!
{
Type *min_val ;
int min_index = 0;
for(int i=1; i<size; i++)
{
if(comp(arr_num[min_index],arr_num[i])>0)
min_index = i;
}
return arr_num[i];
}
--------------------------------------
调试的时候,出现问题:
error C2061: 语法错误 : 标识符“Comp”