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

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402338
This commit is contained in:
Davis King 2008-06-18 23:50:01 +00:00
parent 6cd52824f8
commit 69b4407c50
2 changed files with 14 additions and 0 deletions

View File

@ -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
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);

View File

@ -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
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
!*/ !*/