Commit dc0fd24d authored by Davis King's avatar Davis King

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.
parent c7d67d8e
...@@ -149,10 +149,9 @@ namespace dlib ...@@ -149,10 +149,9 @@ namespace dlib
at_start_(true) at_start_(true)
{ {
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT((nc__ > 0 && nr__ > 0) || DLIB_ASSERT((nc__ >= 0 && nr__ >= 0),
(nc__ == 0 && nr__ == 0),
"\t array2d::array2d(long nr__, long nc__)" "\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 this: " << this
<< "\n\t nc__: " << nc__ << "\n\t nc__: " << nc__
<< "\n\t nr__: " << nr__ << "\n\t nr__: " << nr__
...@@ -419,10 +418,9 @@ namespace dlib ...@@ -419,10 +418,9 @@ namespace dlib
) )
{ {
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT((nc__ > 0 && nr__ > 0) || DLIB_ASSERT((nc__ >= 0 && nr__ >= 0) ,
(nc__ == 0 && nr__ == 0),
"\tvoid array2d::set_size(long nr__, long nc__)" "\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\tthis: " << this
<< "\n\tnc__: " << nc__ << "\n\tnc__: " << nc__
<< "\n\tnr__: " << nr__ << "\n\tnr__: " << nr__
......
...@@ -128,8 +128,7 @@ namespace dlib ...@@ -128,8 +128,7 @@ namespace dlib
); );
/*! /*!
requires requires
- cols > 0 && rows > 0 or - rows >= 0 && cols >= 0
cols == 0 && rows == 0
ensures ensures
- #nc() == cols - #nc() == cols
- #nr() == rows - #nr() == rows
...@@ -174,8 +173,7 @@ namespace dlib ...@@ -174,8 +173,7 @@ namespace dlib
); );
/*! /*!
requires requires
- cols > 0 && rows > 0 or - rows >= 0 && cols >= 0
cols == 0 && rows == 0
ensures ensures
- #nc() == cols - #nc() == cols
- #nr() == rows - #nr() == rows
......
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