I believe this is a complete implementation of std::shift_left and std::shift_right from
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0769r2.pdf
Some test cases copied-with-modification from D60027.
Paths
| Differential D93819
[libc++] Implement [P0769] "Add shift to algorithm" (shift_left, shift_right) ClosedPublic Authored by • Quuxplusone on Dec 25 2020, 11:26 PM.
Details
Summary I believe this is a complete implementation of std::shift_left and std::shift_right from Some test cases copied-with-modification from D60027.
Diff Detail
Event TimelineComment Actions Can you also grab the tests from https://reviews.llvm.org/D60027? Generally speaking, while programmatic tests (like the two nested loops you used) are great because it gives us great coverage, however I try to strike a balance and also have at least some basic and really dumb test cases written entirely manually. This avoids the risk of a bug in the tests. For some reason, that revision doesn't show up in the "Open Libc++ Reviews" query. I'll try to understand why and fix it.
This revision now requires changes to proceed.Jan 11 2021, 2:56 PM Comment Actions @Quuxplusone I like this patch a lot better than mine. It seems like this implementation is essentially following the sample in the paper. I was meaning to update mine to use that approach but didn't find the time/remember. Anyway, this looks good to me, thanks! Comment Actions I'm not done with the review, but I figured I might as well give you the feedback I have right away. It generally looks good, but I think you might have forgotten about n < 0 in both algorithms.
This revision now requires changes to proceed.Jan 18 2021, 2:29 PM • Quuxplusone added inline comments.
• Quuxplusone marked 5 inline comments as done. Comment Actions(->[ Comment Actions
Ah ah. How confusing. Now it makes more sense. This revision is now accepted and ready to land.Jan 25 2021, 8:18 AM Closed by commit rG3fbd3eaf28c1: [libc++] Implement [P0769] "Add shift to algorithm" (shift_left, shift_right) (authored by • arthur.j.odwyer). · Explain WhyJan 25 2021, 9:57 AM This revision was automatically updated to reflect the committed changes. Comment Actions
Sorry for being late.
Revision Contents
Diff 313740 libcxx/docs/Cxx2aStatusPaperStatus.csv
libcxx/docs/FeatureTestMacroTable.rst
libcxx/include/algorithm
libcxx/include/version
libcxx/test/std/algorithms/alg.modifying.operations/alg.shift/shift_left.pass.cpp
libcxx/test/std/algorithms/alg.modifying.operations/alg.shift/shift_right.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/algorithm.version.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
libcxx/utils/generate_feature_test_macro_components.py
|
shift_right isn't constexpr in the paper (haven't looked at why yet). We're not allowed to add this as an extension.