From 0f6102c6890e263fd78c98e475b90bd54f63d09f Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 5 Dec 2023 17:04:32 -0800 Subject: [PATCH 1/2] Fix copy-paste damage in ranges.rotate_copy.pass.cpp. --- .../alg.rotate/ranges.rotate_copy.pass.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/ranges.rotate_copy.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/ranges.rotate_copy.pass.cpp index 1f18d787c2f4c..58b0f75d9b5f2 100644 --- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/ranges.rotate_copy.pass.cpp +++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/ranges.rotate_copy.pass.cpp @@ -34,16 +34,16 @@ template concept HasRotateCopyR = requires(Range range, Out out) { std::ranges::rotate_copy(range, nullptr, out); }; static_assert(HasRotateCopyIt); -static_assert(!HasRotateCopyIt); -static_assert(!HasRotateCopyIt); +static_assert(!HasRotateCopyIt); +static_assert(!HasRotateCopyIt); static_assert(!HasRotateCopyIt); static_assert(!HasRotateCopyIt); static_assert(!HasRotateCopyIt); static_assert(!HasRotateCopyIt); static_assert(HasRotateCopyR>); -static_assert(!HasRotateCopyR); -static_assert(!HasRotateCopyR); +static_assert(!HasRotateCopyR); +static_assert(!HasRotateCopyR); static_assert(!HasRotateCopyR>); static_assert(!HasRotateCopyR, OutputIteratorNotIndirectlyWritable>); static_assert(!HasRotateCopyR, OutputIteratorNotInputOrOutputIterator>); @@ -112,6 +112,7 @@ constexpr void test_out_iterators() { } constexpr bool test() { + test_out_iterators>(); test_out_iterators>(); test_out_iterators>(); test_out_iterators>(); From 0bb32a2c112177469ed8cd2eda98e03e7f5b5689 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 5 Dec 2023 21:19:05 -0800 Subject: [PATCH 2/2] Fix copy-paste damage in ranges_rotate_copy.h. In addition to taking `forward_iterator` and `forward_range` as depicted in the Standard, this drops the inclusion of `<__iterator/reverse_iterator.h>` as this algorithm doesn't need `std::__reverse_range`. --- libcxx/include/__algorithm/ranges_rotate_copy.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libcxx/include/__algorithm/ranges_rotate_copy.h b/libcxx/include/__algorithm/ranges_rotate_copy.h index 301672707f72b..ab76c0944c477 100644 --- a/libcxx/include/__algorithm/ranges_rotate_copy.h +++ b/libcxx/include/__algorithm/ranges_rotate_copy.h @@ -13,7 +13,6 @@ #include <__algorithm/ranges_copy.h> #include <__config> #include <__iterator/concepts.h> -#include <__iterator/reverse_iterator.h> #include <__ranges/access.h> #include <__ranges/concepts.h> #include <__ranges/dangling.h> @@ -34,7 +33,7 @@ using rotate_copy_result = in_out_result<_InIter, _OutIter>; namespace __rotate_copy { struct __fn { - template _Sent, weakly_incrementable _OutIter> + template _Sent, weakly_incrementable _OutIter> requires indirectly_copyable<_InIter, _OutIter> _LIBCPP_HIDE_FROM_ABI constexpr rotate_copy_result<_InIter, _OutIter> operator()(_InIter __first, _InIter __middle, _Sent __last, _OutIter __result) const { @@ -43,7 +42,7 @@ struct __fn { return {std::move(__res1.in), std::move(__res2.out)}; } - template + template requires indirectly_copyable, _OutIter> _LIBCPP_HIDE_FROM_ABI constexpr rotate_copy_result, _OutIter> operator()(_Range&& __range, iterator_t<_Range> __middle, _OutIter __result) const {