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:
parent
9eb54d16bb
commit
8fb0d5509c
1 changed files with 2 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue