The return value for both of these algorithms is specified as
`{last, result - N}` for the overloads in namespace `ranges`.But the current implementation instead returns {first, result - N}.
Also add both algorithms to the relevant "robust" tests.
Paths
| Differential D130968
[libc++][ranges] Fix the return value of `{copy,move}_backward`. ClosedPublic Authored by var-const on Aug 2 2022, 12:59 AM.
Details
Summary The return value for both of these algorithms is specified as `{last, result - N}` for the overloads in namespace `ranges`.But the current implementation instead returns {first, result - N}. Also add both algorithms to the relevant "robust" tests.
Diff Detail
Event TimelineComment Actions LGTM % nit.
This revision is now accepted and ready to land.Aug 2 2022, 2:54 AM var-const added inline comments. Closed by commit rGf537a01d3989: [libc++][ranges] Fix the return value of `{copy,move}_backward`. (authored by var-const). · Explain WhyAug 2 2022, 10:24 PM This revision was automatically updated to reflect the committed changes. var-const marked an inline comment as done.
Revision Contents
Diff 449204 libcxx/include/__algorithm/copy_backward.h
libcxx/include/__algorithm/ranges_move_backward.h
libcxx/test/std/algorithms/alg.modifying.operations/alg.copy/ranges.copy_backward.pass.cpp
libcxx/test/std/algorithms/alg.modifying.operations/alg.move/ranges.move_backward.pass.cpp
libcxx/test/std/algorithms/ranges_robust_against_dangling.pass.cpp
libcxx/test/std/algorithms/ranges_robust_against_proxy_iterators.pass.cpp
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Pre-existing: Could you make copy and move consistent w.r.t. using __reverse_range?