Quote:Original post by MagpieOfDoom
Quote:Original post by NoahAdlertemplate <size_t m, size_t n, size_t p>Matrix<m,p> operator* (Matrix<m,n> const& lhs, Matrix<n,p> const& rhs) { ...}
How would this work? I have never seen an operator templated...
Would it be, like, MyMatrix4X4 *<4, 4, 4> MyTarget4X4?
No, it will deduce the types, it would work as:
Matrix<4,1> m;Matrix<1, 4> n;Matrix<4,4> p = m * n;
Quote:Original post by MagpieOfDoom
And, jyk -- I am using VC++ 6, which is pretty solid.
Err no its actually the worse compiler to work with templates in, regardless of un-rolling loops or not.
You should also know that a naive implementation when used with complex expressions of arbitrary sized matrices & vectors will result in
serious performance problems because of the over-head temporaries introduce, if your seriously going to do this then you should look into
expression templates they over come the problems of temporaries but i'm warning you its really advance template stuff so you should consider using a library instead and get an up to date compiler thats more standard compliant.
I don't know if muer's code handles this case i have not looked at his code.
Another thing you can unroll loops via meta-template programming (among other things [smile]) but you may actually
degrade performance if you go over-board with unrolling loops.
[Edited by - snk_kid on February 12, 2005 5:58:11 PM]