Commit 828f7bbb authored by Davis King's avatar Davis King

Added a missing requires clause to the kkmeans object.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402367
parent 3946767f
...@@ -58,6 +58,15 @@ namespace dlib ...@@ -58,6 +58,15 @@ namespace dlib
unsigned long i unsigned long i
) const ) const
{ {
// make sure requires clause is not broken
DLIB_ASSERT(i < number_of_centers(),
"\tkcentroid kkmeans::get_kcentroid(i)"
<< "\n\tYou have given an invalid value for i"
<< "\n\ti: " << i
<< "\n\tnumber_of_centers(): " << number_of_centers()
<< "\n\tthis: " << this
);
return *centers[i]; return *centers[i];
} }
......
...@@ -65,6 +65,8 @@ namespace dlib ...@@ -65,6 +65,8 @@ namespace dlib
unsigned long i unsigned long i
) const; ) const;
/*! /*!
requires
- i < number_of_centers()
ensures ensures
- returns a const reference to the ith kcentroid object contained in - returns a const reference to the ith kcentroid object contained in
this object. Each kcentroid represents one of the centers found this object. Each kcentroid represents one of the centers found
......
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