-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix paring heap UB #1747
fix paring heap UB #1747
Conversation
cbf7ccb
to
865289b
Compare
I'm not really in favor of this change as making the iteration over the heap nodes non-const can have severe side effects. e.g. by changing the node values that are used for comparison, which would result in corruption of the entire datastructure. I thought about this for a while and I think we should use a dedicated erasure method for |
Do you think it might be worth implementing an iterator for the tree? |
That would be cool! Currently we can get a problem with the recursion depth if the tree is too large. An iterator should solve that. |
6b485a4
to
2668d9e
Compare
iterator added |
2668d9e
to
6b53ded
Compare
6b53ded
to
aef6cf0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice solution!
I changed the test code slightly at the end by changing the C array to a C++ std::array
which is a bit more "stable" for test code.
No description provided.