diff --git a/dlib/matrix/matrix.h b/dlib/matrix/matrix.h index 17255945c..fe85544ec 100644 --- a/dlib/matrix/matrix.h +++ b/dlib/matrix/matrix.h @@ -1463,10 +1463,10 @@ namespace dlib } - bool is_copy; matrix* m; mutable long r; mutable long c; + bool is_copy; }; public: diff --git a/dlib/test/matrix.cpp b/dlib/test/matrix.cpp index 8bf96f8de..9cad26bbe 100644 --- a/dlib/test/matrix.cpp +++ b/dlib/test/matrix.cpp @@ -1825,6 +1825,31 @@ namespace DLIB_CASSERT(( uniform_matrix(3)*identity_matrix() == uniform_matrix(3) ), ""); } + { + matrix m(2,3); + m << 1,2,3, + 5,6,7; + + DLIB_CASSERT(m(0,0) == 1 && m(0,1) == 2 && m(0,2) == 3 && + m(1,0) == 5 && m(1,1) == 6 && m(1,2) == 7,""); + + matrix m2; + m2 << 1,2,3, + 5,6,7; + DLIB_CASSERT(m2(0,0) == 1 && m2(0,1) == 2 && m2(0,2) == 3 && + m2(1,0) == 5 && m2(1,1) == 6 && m2(1,2) == 7,""); + + matrix m3; + m3 << 1, + 5; + DLIB_CASSERT(m3(0) == 1 && m3(1) == 5 ,""); + + matrix m4; + m4 << 1, 5; + DLIB_CASSERT(m3(0) == 1 && m3(1) == 5 ,""); + } + + }