#ifndef _grid_h
#define _grid_h
#include<string>
using namespace std;
template<typename T>
class grid{
T** main;
public:
grid<T>(){}
grid<T>(int col, int row){
main = new T[col]; //<-this line gives me error C2440:
//'=' : cannot convert from 'int *' to 'int **'
for(int i =0;i<col;i++)
main[i]=new T[row];
}
};
#endif
我想创建自己的Grid类版本。基本上我想将信息保存在T的二维数组中。我认为这是最有效的方法。现在我怎样才能解决这个错误?错误C2440:'=':无法从'int *'转换为'int **'