Turned some DLIB_ASSERT() statements into DLIB_CASSERT() since it gives

better error reporting and is not a speed bottleneck.
This commit is contained in:
Davis King 2015-06-21 09:12:11 -04:00
parent f0ccfd40c3
commit c590ee6710
1 changed files with 3 additions and 5 deletions

View File

@ -341,7 +341,7 @@ namespace dlib
boxes_overlap(overlap_tester)
{
// make sure requires clause is not broken
DLIB_ASSERT(scanner_.get_num_detection_templates() > 0 && w_.size() > 0,
DLIB_CASSERT(scanner_.get_num_detection_templates() > 0 && w_.size() > 0,
"\t object_detector::object_detector(scanner_,overlap_tester,w_)"
<< "\n\t Invalid inputs were given to this function "
<< "\n\t scanner_.get_num_detection_templates(): " << scanner_.get_num_detection_templates()
@ -349,10 +349,9 @@ namespace dlib
<< "\n\t this: " << this
);
#ifdef ENABLE_ASSERTS
for (unsigned long i = 0; i < w_.size(); ++i)
{
DLIB_ASSERT(w_[i].size() == scanner_.get_num_dimensions() + 1,
DLIB_CASSERT(w_[i].size() == scanner_.get_num_dimensions() + 1,
"\t object_detector::object_detector(scanner_,overlap_tester,w_)"
<< "\n\t Invalid inputs were given to this function "
<< "\n\t scanner_.get_num_detection_templates(): " << scanner_.get_num_detection_templates()
@ -361,7 +360,6 @@ namespace dlib
<< "\n\t this: " << this
);
}
#endif
scanner.copy_configuration(scanner_);
w.resize(w_.size());
@ -382,7 +380,7 @@ namespace dlib
const std::vector<object_detector>& detectors
)
{
DLIB_ASSERT(detectors.size() != 0,
DLIB_CASSERT(detectors.size() != 0,
"\t object_detector::object_detector(detectors)"
<< "\n\t Invalid inputs were given to this function "
<< "\n\t this: " << this