You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If etl::max_element is called with an empty range, i.e. begin == end, it causes undefined behavior. According to https://en.cppreference.com/w/cpp/algorithm/max_element, it should return end instead if the range is empty.
The root cause is that begin is incremented first, which leads to begin pointing to the element after end. Then, the while-loop will execute and begin will be dereferenced.
The text was updated successfully, but these errors were encountered:
If etl::max_element is called with an empty range, i.e.
begin == end
, it causes undefined behavior. According to https://en.cppreference.com/w/cpp/algorithm/max_element, it should returnend
instead if the range is empty.The root cause is that
begin
is incremented first, which leads tobegin
pointing to the element afterend
. Then, the while-loop will execute andbegin
will be dereferenced.The text was updated successfully, but these errors were encountered: