C++ templates - matrix class
- by lastOfMohicans
Hi
I'm learning templates in C++ so I decied to write matrix class which would be a template class. In Matrix.h file I wrote
#pragma once
#include "stdafx.h"
#include <vector>
using namespace std;
template<class T>
class Matrix
{
public:
Matrix();
~Matrix();
GetDataVector();
SetDataVector(vector<vector<T>> dataVector);
bool operator == (Matrix* matrix);
bool operator < (Matrix* matrix);
bool operator <= (Matrix* matrix);
bool operator > (Matrix* matrix);
bool operator >= (Matrix* matrix);
Matrix* operator + (Matrix* matrix);
Matrix* operator - (Matrix* matrix);
Matrix* operator * (Matrix* matrix);
private:
vector<vector<T>> datavector;
int columns,rows;
};
In Matrix cpp Visual Stuio automaticlly generated code for default constructors
#include "StdAfx.h"
#include "Matrix.h"
Matrix::Matrix()
{
}
Matrix::~Matrix()
{
}
However if I want to compile this I get an error
'Matrix' : use of class template
requires template argument list
The error are in file Matrix.cpp in default constructors
What may be the problem ??