]> git.tdb.fi Git - libs/math.git/blobdiff - source/linal/matrix.h
Fix Matrix template copy constructor
[libs/math.git] / source / linal / matrix.h
index ff73165d02c703c0efe263b27f23a522c54b7383..83a64f50dd767ff1497804378be48160e8691ed0 100644 (file)
@@ -54,9 +54,11 @@ inline Matrix<T, M, N>::Matrix(const T *d)
 
 template<typename T, unsigned M, unsigned N>
 template<typename U>
-inline Matrix<T, M, N>::Matrix(const Matrix<U, M, N> &m)
+inline Matrix<T, M, N>::Matrix(const Matrix<U, M, N> &other)
 {
-       std::copy(m.data, m.data+M*N, data);
+       for(unsigned i=0; i<M; ++i)
+               for(unsigned j=0; j<N; ++j)
+                       element(i, j) = other(i, j);
 }
 
 template<typename T, unsigned M, unsigned N>