Details
- Reviewers
philnik huixie90 ldionne - Group Reviewers
Restricted Project - Commits
- rG8ed702b83f20: [libc++][ranges] Implement `ranges::{,stable_}partition`.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
The algorithm LGTM. Regarding testing, I still prefer to have extra tests to verify iter_move and/or iter_swap is correctly used
libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/ranges_stable_partition.pass.cpp | ||
---|---|---|
236 | as these algorithms involves iter_move, I suggests to add tests to verify the outputs before we can figure out an automated way to catch in via a compile-time tests. so here , we could have std::array<MoveOnly, N> a{...]; ProxyRange r{a}; std::ranges::partition(r); // verify that the original `a` is partitioned as the expected result (actually even without verifying the result, the compiler would catch std::move(*it) because std::move(*it) would copy the MoveOnly for Proxy<MoveOnly&>&& and MoveOnly is not copyable |
libcxx/include/__algorithm/iterator_operations.h | ||
---|---|---|
92 | This is copied from https://reviews.llvm.org/D129796. | |
libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/ranges_stable_partition.pass.cpp | ||
236 | I'd prefer to do these checks en masse: https://reviews.llvm.org/D130057 |
@philnik I'm going to merge this, but happy to address any comments you might have in a follow-up.
This is copied from https://reviews.llvm.org/D129796.