I’m have a homework that tell us to create a template for a matrix where the column number of the matrix1 is equal to the row number of the column 2
I tried that:
#define TEMPLATEMATRIXCR template<class T, int , int >
TEMPLATEMATRIXCR Matrix<T, R> operator* (Matrix<T, int, R> a, Matrix<T, R, int> b);
It dont work, for example
Matrix [10][30]
Matrix [20][10]
So I need the matrix with [20][30]; //sorry if my logic is messed.
It tells me that the E is not defined.
In the first moment I did
TEMPLATEMATRIX Matrix<T, C, R> operator* (Matrix<T, C, R> a, Matrix<T,R, C> b);
But it’s not what he wants, so now I can’t just fix 2 numbers and make the others “free”
How can I do that using templates?
I’m likely not quite getting what you’re asking, but isn’t this ultimately what you’re trying to do?
Or are you trying to just make C1 and R2 programatically arbitrary?