Implements part of P0896 'The One Ranges Proposal'.
Implements [range.iter.op.prev].
Depends on D102563.
Paths
| Differential D102564
[libcxx][iterator] adds `std::ranges::prev` ClosedPublic Authored by cjdb on May 15 2021, 6:41 PM.
Details
Diff Detail
Unit TestsFailed Event TimelineComment Actions SGTM, but I would like to know what our way forward will be with [[nodiscard]] before approving.
Comment Actions
I think this patch was put up for review after several days of no opposition to my proposal, but before your reply (which I need to reply to). • Quuxplusone added inline comments.
cjdb added a child revision: D102789: [libcxx][iterator] adds `std::ranges::distance`.May 19 2021, 10:55 AM Comment Actions LGTM after updating the synopsis, the small comment changes and adjusting the [[nodiscard]] after discussing it on Discord. Comment Actions Applies @ldionne's feedback (from D102563, since these two patches are siblings):
This revision is now accepted and ready to land.May 26 2021, 4:06 PM Closed by commit rG0dc7fd1bc167: [libcxx][iterator] adds `std::ranges::prev` (authored by cjdb). · Explain WhyMay 26 2021, 9:42 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 347843 libcxx/include/CMakeLists.txt
libcxx/include/__iterator/prev.h
libcxx/include/iterator
libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.prev/check_round_trip.h
libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.prev/constraints.verify.cpp
libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.prev/iterator.pass.cpp
libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.prev/iterator_count.pass.cpp
libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.prev/iterator_count_sentinel.pass.cpp
libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.prev/special_function.compile.pass.cpp
|
FWIW I think it makes sense to have nodiscard here because it might be confusing to users that think next behaves like advance (advance takes a reference, this one doesn't).