안녕하세요 저는 C++로 템플릿을 배우므로 템플릿 클래스가 될 매트릭스 클래스를 작성하기로했습니다. Matrix.h 파일에서 나는C++ 템플릿 - 매트릭스 클래스
#include "StdAfx.h"
#include "Matrix.h"
Matrix::Matrix()
{
}
Matrix::~Matrix()
{
}
그러나 나는 오류를 얻을이 컴파일하려는 경우 기본 생성자에 대한 매트릭스 cpp에있는 비주얼 Stuio automaticlly 찾을 생성 된 코드를
#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;
};
을 썼다
' Matrix ': 클래스 템플릿 사용 템플릿 인수 목록이 필요합니다. 오류는 기본 생성자의 Matrix.cpp 파일에 있습니다. 전자 문제 ??
당신은'bool operator == (행렬 * 행렬); 대신'bool operator == (const 행렬 & 행렬) const; '를 원합니다. 또한'std :: vector'는 자체적으로 정리되기 때문에 소멸자가 필요 없습니다. – fredoverflow
armadillo (http://arma.sourceforge.net/download.html)의 소스 코드를 볼 수도 있습니다. 출처는 분명하고 도서관은 훌륭합니다. 그건 그렇고 적극적으로 괜찮은 C++ 선형 대수 라이브러리를 유지 관리하는 것입니다. –