[libcxx-commits] [PATCH] D117817: [libc++][ranges] Implement ranges::mismatch
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Mar 7 10:00:02 PST 2022
ldionne requested changes to this revision.
ldionne added inline comments.
This revision now requires changes to proceed.
================
Comment at: libcxx/include/__algorithm/ranges_mismatch.h:61
+ _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
+ return __go(std::move(__first1), __last1, std::move(__first2), __last2, __pred, __proj1, __proj2);
+ }
----------------
Any reason why we don't implement the algorithm here and then call `*this` in the range version immediately below?
================
Comment at: libcxx/include/algorithm:47-58
+ template <input_iterator I1, sentinel_for<_I1> S1, input_iterator I2, sentinel_for<_I2> S2,
+ class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
+
+ requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
+ constexpr mismatch_result<_I1, _I2>
+ mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {})
+
----------------
This is strangely formatted. Also, we need to say `// since C++20`.
================
Comment at: libcxx/test/std/algorithms/alg.nonmodifying/mismatch/ranges_mismatch.pass.cpp:106
+
+ { // test with a range
+ std::array<int, 5> a = {1, 2, 3, 4, 5};
----------------
We should add test with non-default projections and predicate for the range overload.
Edit: And for the iterator overload too, since it appears we don't have such tests.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117817/new/
https://reviews.llvm.org/D117817
More information about the libcxx-commits
mailing list