template<class T>
class coulomn {
public:
coulomn();
~coulomn();
int addcoulomn();
int addvalue( int x, int y, T t);
T printvalue( int x, int y);
int resize( int x, int y);
private:
vector<vector<T>> matrix;
int _sizeX, _sizeY;
};
#include "coulomn.h"
template<class T>
coulomn<T>::coulomn() {
_sizeX=0;
_sizeY=0;
}
template<class T>
coulomn<T>::~coulomn() {
}
template<class T>
int coulomn<T>::addcoulomn(){
matrix.emplace_back(NULL);
return 0;
}
我试图用用户定义类型的vector创建矩阵,但是我的模板类不起作用。如果我使用例如int对其进行测试,则可以正常工作,但是我无法实现模板