안녕하세요, "제어가 무효 기능의 끝"에 도달했을 때 어떻게해야합니까? 내 오버로드 된 연산자가 시도하고 시도 범위에 returns *this ;
catch하고 있습니다. 나는 이클립스를 사용하고시도하고 catch 할 때 C++ 반환 값
은 G ++ 컴파일러, 우분투 리눅스입니다
NNmatrix & operator*=(const NNmatrix<T> &mtrxB)
{
// A=2*3 B=3*4 return C=2*4
const UINT aRows = this->size1();
const UINT aCols = this->size2();
const UINT bRows = mtrxB.size1();
const UINT bCols = mtrxB.size2();
try
{
// if cols of first(this) matrix == rows of second matrix
if (aCols != bRows) throw bad_alloc();
const UINT cRows = aRows;// = rows of first matrix
const UINT cCols = bCols; // = cols of second matrix
NNmatrix mtrxC(cRows, cCols);
T val;
for (UINT i = 0; i < cRows; i++)
{
for (UINT j = 0; j < cCols; j++)
{
val = 0;
for (UINT k = 0; k < bRows; k++)
{
val += this->matrix.at(i).at(k) * mtrxB.getElement(k, j);
}
mtrxC.setElement(i, j, val);
}
}
*this = mtrxC;
mtrxC.clear();
return *this;
}
catch (exception& e)
{
cout<<"Dimension don't match: ("<<aRows<<","<<aCols<<") ("<<bRows<<","<<bCols<<")"<<endl;
}
}
코드를 게시하십시오 (사용중인 컴파일러). – egrunin
경고를 수정해야합니다. 자, 문제를 보여주는 예제가 있습니까? –
코드를 게시하십시오. 문제의 막연한 아이디어 만 얻을 수 있습니다. –