template
struct acc_med
{
inline acc_med(int poolHeight, int poolWidth, type derOutput = 0)
:
value(-std::numeric_limits::infinity()),
derOutput(derOutput),
derDataActivePt(NULL)
{ }
int i; type* array;
inline void accumulate_forward(type x) {
/*value = std::max(value, x) ;*/
array[i]=x;
for (int k=1;k
for(int j=0;j
if(array[j]>array[i]){
int temp= array[i];
for(int p=i;p>j;p--){
array[p]=array[p-1];
}
array[j]=temp;
break;
}
}
if (i<8)
i++;
else
value=array[4];
i=0;
}
如题,这个代码是一个结构体的一部分, 外面调用accumulate_forward函数时每次会传入一个值,本来是取最大值(注释掉的那句),现在想修改,想要该函数实现排序功能,然后返回中值,应该怎么写。编程很差,尤其是对结构体类的处理不理解,希望各位耐心指教