fix longest span
This commit is contained in:
parent
f03b0d6a42
commit
dcd70a7091
@ -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());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user