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

ADL-proof implementation of [alg.merge], [alg.set.operations], [alg.heap.operations], and [alg.permutation.generators] #4347

Conversation

frederick-vs-ja
Copy link
Contributor

Separated from #4004. Towards #140 and #1596.

@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner January 28, 2024 17:43
@StephanTLavavej StephanTLavavej added the bug Something isn't working label Jan 28, 2024
@StephanTLavavej StephanTLavavej self-assigned this Jan 28, 2024
(void) std::set_symmetric_difference(varr, varr, varr, varr, varr3);
(void) std::set_symmetric_difference(iarr, iarr, iarr, iarr, iarr3, validating_less{});

std::push_heap(varr3, varr3 + 1); // requires Cpp17ValueSwappable
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that MSVC STL's std::push_heap, std::pop_heap, std::make_heap, and std::sort_heap don't require Cpp17ValueSwappable (i.e. don't use ADL-found swap) currently. Should we keep these test cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nor do libstdc++'s and libc++'s (Godbolt link).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should. The fact that we don't swap today doesn't mean we never will; these test cases are useful to prevent regression.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CaseyCarter If I understand this correctly, if we started ADL-swapping in meow_heap in the future, these test cases would inherently fail to compile, because ADL-swapping is incompatible with the Incomplete scenario. I'm fine with that because we'd just comment them out like the other swapping test cases.

(void) std::set_symmetric_difference(varr, varr, varr, varr, varr3);
(void) std::set_symmetric_difference(iarr, iarr, iarr, iarr, iarr3, validating_less{});

std::push_heap(varr3, varr3 + 1); // requires Cpp17ValueSwappable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this for now.

@StephanTLavavej StephanTLavavej removed their assignment Jan 30, 2024
@StephanTLavavej StephanTLavavej self-assigned this Jan 30, 2024
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit b89a780 into microsoft:main Jan 30, 2024
35 checks passed
@StephanTLavavej
Copy link
Member

Thanks for fixing more algorithms! 📈 🛠️ 😺

@frederick-vs-ja frederick-vs-ja deleted the adl-proof-merge-heap-set-permutation branch January 30, 2024 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants