Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional edge test in max-of-vector needed #242

Open
mariuszlisowski opened this issue May 15, 2021 · 2 comments
Open

Additional edge test in max-of-vector needed #242

mariuszlisowski opened this issue May 15, 2021 · 2 comments

Comments

@mariuszlisowski
Copy link

Test against the edge case when the vector is empty. Could be useful when std::max_element() is used form algorithm header and dereferencing its result could cause segmentation fault.

If iterative solution is used, when nothing is found then std::numeric_limits::min() may be returned if defined.
Similarly if max is initialized with the first element of a vector - SegFault.

@ziobron
Copy link
Contributor

ziobron commented May 15, 2021

🏅 2 XP granted for @mariuszlisowski
Thanks for raising this Issue to help to make the course better!

@ziobron
Copy link
Contributor

ziobron commented May 23, 2021

@mariuszlisowski Would you try to add this new edge case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants