//Ex5_22.cpp
#include "iostream" 
using namespace std;
template <class T,int Rows,int Cols>
void sumAll(T data[][Cols],T result[])
{for(int i=0;i<Rows;i++)
	{result[i]=0;
     for(int j=0;j<Cols;j++)result[i]+=data[i][j];}
}
void main()
{int d[][3]={{2,3,4},{4,5,6}};
 int r[2];
 sumAll<int,2,3>(d,r);		//必须显式给出对应于常规参数的模板实参
 cout<<r[0]<<' '<<r[1]<<endl;
 double dd[][4]={{1.1,2.2,3.3,4.4},{2.2,3.3,4.4,5.5},{3.3,4.4,5.5,6.6}};
 double rr[3];
 sumAll<double,3,4>(dd,rr);   //必须显式给出对应于常规参数的模板实参
 cout<<rr[0]<<' '<<rr[1]<<' '<<rr[2]<<endl;
}
