Bugfix: when retrieving the best element of an empty population eoPop, segfault. Fixed by launching an exception in this case.

This commit is contained in:
Benjamin Bouvier 2012-07-26 16:16:14 +02:00
commit 8fb0d5509c

View file

@ -201,6 +201,8 @@ public:
#else
typename eoPop<EOT>::const_iterator it = std::max_element(begin(), end());
#endif
if( it == end() )
throw std::runtime_error("eoPop<EOT>: Empty population, when calling best_element().");
return (*it);
}