55 lines
1.3 KiB
C++
55 lines
1.3 KiB
C++
//-------------------------------------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2007, SH Software Co. Ltd.
|
|
// = FileName : SqTable2 模板类
|
|
// = Version : ver2.0
|
|
// = Author : zjq
|
|
// = CreateDate : 2002-09-09
|
|
// = Description: SqTable2 声明二维数组,可以视为具有无限行列的矩阵
|
|
// = Maintainers:
|
|
//
|
|
//-------------------------------------------------------------------------------------------------------+
|
|
#ifndef _SQTABLE2_H_
|
|
#define _SQTABLE2_H_
|
|
|
|
#ifndef _SQPTABLE_H_
|
|
#include "SqPTable.h"
|
|
#endif
|
|
|
|
template<class T> class SqTable2 : public SqPTable< SqTable<T> >
|
|
{
|
|
public:
|
|
|
|
SqTable2(long rowNum = 0, long colNum = 0);
|
|
~SqTable2(){}
|
|
|
|
void Realloc(long rowNum, long colNum, bool bCopy = true);
|
|
|
|
void SetAll(const T& t);
|
|
};
|
|
|
|
template<class T>
|
|
SqTable2<T>::SqTable2(long rowNum,long colNum)
|
|
{
|
|
Realloc(rowNum,colNum,false);
|
|
}
|
|
|
|
template<class T>
|
|
void SqTable2<T>::Realloc(long rowNum,long colNum,bool bCopy)
|
|
{
|
|
SqPTable< SqTable<T> >::SetLength(rowNum,bCopy);
|
|
for(this->MoveToFirst();!this->IsOut();this->MoveToNext())
|
|
{
|
|
this->GetCurData().SetLength(colNum,bCopy);
|
|
}
|
|
}
|
|
|
|
template<class T>
|
|
void SqTable2<T>::SetAll(const T&t)
|
|
{
|
|
for(this->MoveToFirst();!this->IsOut();this->MoveToNext())
|
|
{
|
|
this->GetCurData().SetAll(t);
|
|
}
|
|
}
|
|
#endif
|