-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Implement ranges::is_permutation #892
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
Conversation
Includes implementation of concepts `indirect_equivalence_relation` and `indirect_strict_weak_order`, and new `<xutility>` helper `_Find_last_iterator(first, last, count)` which - given `[first, last)` of length `count` - returns the iterator that corresponds to `last`. Drive-by: * Move `std::is_permutation` from `<xutility>` into `<algorithm>`, leaving behind the `_Check_match_counts` helper which is used elsewhere in the STL. * Allow clang-format to handle the algorithm result types since they now have no requires-clauses.
miscco
left a comment
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.
Whenever i see is_permutation i cringe about the cost involved. That said the code is great!
libc++ `unordered_meow` tests were assuming that `#include <unordered_meow>` makes `std::is_permutation` available. Drive-by: Inline 4-argument `_Is_permutation_unchecked` into `is_permutation` since this `_unchecked` overload isn't used elsewhere.
mnatsuhara
left a comment
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.
I haven't looked at the is_permutation algorithm before -- nifty 😄
mnatsuhara
left a comment
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.
New test coverage looks great!
Co-authored-by: mnatsuhara <46756417+mnatsuhara@users.noreply.github.com>
... with `_STL_INTERNAL_STATIC_ASSERT` when we don't want to pay the throughput cost of constraints.
|
!ahknsT😸 |
Co-authored-by: mnatsuhara <46756417+mnatsuhara@users.noreply.github.com> Co-authored-by: Stephan T. Lavavej <stl@microsoft.com>
Includes implementation of concepts
indirect_equivalence_relationandindirect_strict_weak_order, and new<xutility>helper_Find_last_iterator(first, last, count)which - given[first, last)of lengthcount- returns the iterator that corresponds tolast.Drive-by:
std::is_permutationfrom<xutility>into<algorithm>, leaving behind the_Check_match_countshelper which is used elsewhere in the STL.Partially addresses #39.