Harmonized the array2d::set_size and matrix::set_size methods.

In particular, array2d::set_size() now simply allows any row and
column sizes so long as they are non-negative.
This commit is contained in:
Davis King 2014-07-12 14:47:52 -04:00
parent c7d67d8e14
commit dc0fd24d89
2 changed files with 6 additions and 10 deletions

View File

@ -149,10 +149,9 @@ namespace dlib
at_start_(true)
{
// make sure requires clause is not broken
DLIB_ASSERT((nc__ > 0 && nr__ > 0) ||
(nc__ == 0 && nr__ == 0),
DLIB_ASSERT((nc__ >= 0 && nr__ >= 0),
"\t array2d::array2d(long nr__, long nc__)"
<< "\n\t You have to give a non zero nc and nr or just make both zero."
<< "\n\t The array2d can't have negative rows or columns."
<< "\n\t this: " << this
<< "\n\t nc__: " << nc__
<< "\n\t nr__: " << nr__
@ -419,10 +418,9 @@ namespace dlib
)
{
// make sure requires clause is not broken
DLIB_ASSERT((nc__ > 0 && nr__ > 0) ||
(nc__ == 0 && nr__ == 0),
DLIB_ASSERT((nc__ >= 0 && nr__ >= 0) ,
"\tvoid array2d::set_size(long nr__, long nc__)"
<< "\n\tYou have to give a non zero nc and nr or just make both zero."
<< "\n\tThe array2d can't have negative rows or columns."
<< "\n\tthis: " << this
<< "\n\tnc__: " << nc__
<< "\n\tnr__: " << nr__

View File

@ -128,8 +128,7 @@ namespace dlib
);
/*!
requires
- cols > 0 && rows > 0 or
cols == 0 && rows == 0
- rows >= 0 && cols >= 0
ensures
- #nc() == cols
- #nr() == rows
@ -174,8 +173,7 @@ namespace dlib
);
/*!
requires
- cols > 0 && rows > 0 or
cols == 0 && rows == 0
- rows >= 0 && cols >= 0
ensures
- #nc() == cols
- #nr() == rows