[libcxx-commits] [PATCH] D117817: [libc++][ranges] Implement ranges::mismatch
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 8 13:53:29 PST 2022
ldionne accepted this revision.
ldionne added a comment.
This revision is now accepted and ready to land.
LGTM with my comments addressed. Thanks!
================
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);
+ }
----------------
philnik wrote:
> ldionne wrote:
> > Any reason why we don't implement the algorithm here and then call `*this` in the range version immediately below?
> With the current implementation the predicates and projections are never moved. using `*this()` would mean we have to move them at least once.
Oh, I see. Clever. Can you please add a libc++ specific test for that? I know it's nitpicky, but that seems like a useful guarantee to test if we're providing it. I suggest finding a simple way to test this because I'll be requesting the same kind of test for other algorithms as well (e.g. `find_if`).
================
Comment at: libcxx/test/std/algorithms/alg.nonmodifying/mismatch/ranges_mismatch.pass.cpp:128
+
+ { // test with different array sized
+ {
----------------
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