M
Martin Magnusson
I'm using a matrix and vector library, that won't compile. When
running g++ I get the error message "macro "minor" passed 5 arguments,
but takes just 1"
The definition of "minor" looks like below, and it takes 3 arguments.
All calls to minor that I have found in the code also pass it three
arguments, so I really don't understand this error.
Does anything look suspicious with the following definition, or must
it be that there is some other definition of minor with a different
number of arguments somewhere?
template <int N, typename T>
T minor(const Vector<N,Vector<N,T> >& in, int row, int col) //ERROR
{
Vector<N-1,Vector<N-1,T> > tmp;
int dst_row, dst_col;
dst_row = 0;
for (int src_row = 0; src_row < N; src_row++) {
if (src_row == row) continue;
dst_col = 0;
for (int src_col = 0; src_col < N; src_col++) {
if (src_col == col) continue;
tmp[dst_row][dst_col] = in[src_row][src_col];
dst_col++;
}
dst_row++;
}
return det(tmp);
}
Thanks
/ martin
running g++ I get the error message "macro "minor" passed 5 arguments,
but takes just 1"
The definition of "minor" looks like below, and it takes 3 arguments.
All calls to minor that I have found in the code also pass it three
arguments, so I really don't understand this error.
Does anything look suspicious with the following definition, or must
it be that there is some other definition of minor with a different
number of arguments somewhere?
template <int N, typename T>
T minor(const Vector<N,Vector<N,T> >& in, int row, int col) //ERROR
{
Vector<N-1,Vector<N-1,T> > tmp;
int dst_row, dst_col;
dst_row = 0;
for (int src_row = 0; src_row < N; src_row++) {
if (src_row == row) continue;
dst_col = 0;
for (int src_col = 0; src_col < N; src_col++) {
if (src_col == col) continue;
tmp[dst_row][dst_col] = in[src_row][src_col];
dst_col++;
}
dst_row++;
}
return det(tmp);
}
Thanks
/ martin