以下是我想通过从用户获取值来构建的模板矩阵。 但是当我编译它。我正在低于错误。为什么错误?C++,模板参数错误
SO_template.cpp: 在成员函数void Matrix<T>::BuildMatrix(std::vector<T, std::allocator<_CharT> >)': SO_template.cpp:44: error: expected
;'之前“它”
如果我使用int专门化我的类它不会抱怨为什么?
template<class T>
class Matrix
{
private:
vector<T> col;
int iNumberOfRow;
int iNumberOfCol;
public:
void BuildMatrix(const std::vector<T> stringArray)
{
std::vector<T>::iterator it= stringArray.begin();
cout<<"Build Matrix irow="<<stringArray.size();
...
...
}
};
可能重复[在哪里,为什么我必须把“模板”和“类型名称”关键字?](HTTP://计算器。 com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords) – 2012-03-16 13:18:20