Commit ac84063f authored by Davis King's avatar Davis King

Made the matrix constructor that uses C arrays explicit and added a COMPILE_TIME_ASSERT

to the scalar*matrix multiplication code so that a user gets a more straight forward
error when they try to multiply a scalar times a matrix that contains matrices.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403365
parent b5c50859
......@@ -776,6 +776,8 @@ namespace dlib
const static long cost = matrix_traits<matrix_mul_scal_exp>::cost;
typedef typename matrix_traits<matrix_mul_scal_exp>::layout_type layout_type;
// You aren't allowed to multiply a matrix of matrices by a scalar.
COMPILE_TIME_ASSERT(is_matrix<type>::value == false);
// This constructor exists simply for the purpose of causing a compile time error if
// someone tries to create an instance of this object with the wrong kind of objects.
......@@ -1103,7 +1105,7 @@ namespace dlib
}
template <typename U, size_t len>
matrix (
explicit matrix (
U (&array)[len]
)
{
......
......@@ -432,7 +432,7 @@ namespace dlib
!*/
template <typename U, size_t len>
matrix (
explicit matrix (
U (&array)[len]
);
/*!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment