[libcxx-commits] [PATCH] D152853: [libc++][PSTL] Implement std::is_partitioned
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jun 14 12:39:28 PDT 2023
ldionne requested changes to this revision.
ldionne added inline comments.
This revision now requires changes to proceed.
================
Comment at: libcxx/include/__algorithm/pstl_is_partitioned.h:41
+ __g_first = std::find_if_not(__policy, __g_first, __g_last, __g_pred);
+ return std::find_if(__g_first, __g_last, __g_pred) == __g_last;
+ },
----------------
You forgot to pass the policy to the `find_if` call.
Also, this could be `std::none_of(__policy, __g_first, __g_last, __g_pred);`.
================
Comment at: libcxx/test/std/algorithms/alg.sorting/alg.partitions/pstl.is_partitioned.pass.cpp:27
+ template <class Policy>
+ void operator()(Policy&& policy) {
+ { // simple test
----------------
You're missing a test that `is_partition(empty-range)` is true.
================
Comment at: libcxx/test/std/algorithms/alg.sorting/alg.partitions/pstl.is_partitioned.pass.cpp:32
+ }
+ { // check that the range is paritioned if the predicate returns true for all elements
+ int a[] = {1, 2, 3, 4, 5};
----------------
`paritioned` => `partitioned`. You probably want to search and replace globally, I can see other instances of this. You also have a few `parititoned` around.
================
Comment at: libcxx/test/std/algorithms/alg.sorting/alg.partitions/pstl.is_partitioned.pass.cpp:44
+ }
+ { // check that an range is partitioned
+ int a[] = {1, 2, 3, 2, 5};
----------------
I think this comment is incomplete
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152853/new/
https://reviews.llvm.org/D152853
More information about the libcxx-commits
mailing list