fix longest span

This commit is contained in:
starnakin 2023-11-22 14:13:49 +01:00
parent f03b0d6a42
commit dcd70a7091

View File

@ -41,7 +41,7 @@ int Span::shortestSpan() const
int Span::longestSpan() const int Span::longestSpan() const
{ {
if (this->_vector.size() == 0) if (this->_vector.size() < 2)
throw std::exception(); throw std::exception();
return *std::max_element(this->_vector.begin(), this->_vector.end()) - *std::min_element(this->_vector.begin(), this->_vector.end()); return *std::max_element(this->_vector.begin(), this->_vector.end()) - *std::min_element(this->_vector.begin(), this->_vector.end());
} }