Commit 69b4407c authored by Davis King's avatar Davis King

Added some missing requires clauses to the max and min functions.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402338
parent 6cd52824
...@@ -171,6 +171,11 @@ namespace dlib ...@@ -171,6 +171,11 @@ namespace dlib
const matrix_exp<EXP>& m const matrix_exp<EXP>& m
) )
{ {
DLIB_ASSERT(m.size() > 0,
"\ttype max(const matrix_exp& m)"
<< "\n\tYou can't ask for the max() of an empty matrix"
<< "\n\tm.size(): " << m.size()
);
typedef typename matrix_exp<EXP>::type type; typedef typename matrix_exp<EXP>::type type;
type val = m(0,0); type val = m(0,0);
...@@ -195,6 +200,11 @@ namespace dlib ...@@ -195,6 +200,11 @@ namespace dlib
const matrix_exp<EXP>& m const matrix_exp<EXP>& m
) )
{ {
DLIB_ASSERT(m.size() > 0,
"\ttype min(const matrix_exp& m)"
<< "\n\tYou can't ask for the min() of an empty matrix"
<< "\n\tm.size(): " << m.size()
);
typedef typename matrix_exp<EXP>::type type; typedef typename matrix_exp<EXP>::type type;
type val = m(0,0); type val = m(0,0);
......
...@@ -682,6 +682,8 @@ namespace dlib ...@@ -682,6 +682,8 @@ namespace dlib
const matrix_exp& m const matrix_exp& m
); );
/*! /*!
requires
- m.size() > 0
ensures ensures
- returns the value of the smallest element of m - returns the value of the smallest element of m
!*/ !*/
...@@ -692,6 +694,8 @@ namespace dlib ...@@ -692,6 +694,8 @@ namespace dlib
const matrix_exp& m const matrix_exp& m
); );
/*! /*!
requires
- m.size() > 0
ensures ensures
- returns the value of the biggest element of m - returns the value of the biggest element of m
!*/ !*/
......
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