问题描述
- 读一段c++源代码,里面的array类里面的输出函数,看不懂什么意思。
- template //看不懂
void array::print(void)
{
if(dim_3==1)
{
int ijk;
bool threeD = (dim_2==1?false:true);
for (k = 0; k< dim_2; k++)
{
if (threeD)
cout<<endl<<""ans(::<<k+1<<"") = ""<<endl;
for(i=0; i<dim_0; i++)
{
for(j=0; j<dim_1; j++)
{if((*this)(ijk)*(*this)(ijk)<1e-12) { cout << "" 0 ""; } else { cout << "" "" << (*this)(ijk) << "" ""; } } cout << endl; } if (threeD) cout<<endl; }}
else
{
cout << ""ERROR: Can only print an array of dimension three or less ...."" << endl;
}
}
时间: 2024-10-29 08:05:07