Details
- Reviewers
ldionne Mordante var-const - Group Reviewers
Restricted Project - Commits
- rG1d1a191edcfa: [libc++] Implement ranges::reverse
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
In general looks really good, thanks! (just a few comments)
libcxx/include/__algorithm/ranges_reverse.h | ||
---|---|---|
40 | Question: how is this loop more efficient than the non-random access iterator version? | |
libcxx/test/std/algorithms/alg.modifying.operations/alg.reverse/ranges.reverse.pass.cpp | ||
12 | Can you also check the complexity requirement? | |
34 | Can you also check the permutable constraint? | |
47 | Nit: decltype(auto). | |
62 | Please also check an odd number of elements. | |
libcxx/test/support/almost_satisfies_types.h | ||
142 | Nit: make it a struct, so that it won't be necessary to specify public? |
- Address comments
libcxx/include/__algorithm/ranges_reverse.h | ||
---|---|---|
40 | In the forward variant we have to check that __first != __end and __first != --__end. In the random-access version we can just check that __first < --__end, so we do half the comparisons. | |
libcxx/test/support/almost_satisfies_types.h | ||
142 | I made everything else in this file a class and then made it public. I'd rather keep it that way for consistency. |
Thanks! Sorry about slow reviews.
libcxx/test/support/almost_satisfies_types.h | ||
---|---|---|
199 | Nit: there's an extra blank line here. |
Question: how is this loop more efficient than the non-random access iterator version?