diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2022-08-13 15:37:04 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2023-02-08 19:04:56 +0000 |
commit | 61cfbce3347e4372143bcabf7b197577b9f3958a (patch) | |
tree | a996b7140fcecf4ec110b2ac28983b858e5df637 /contrib/llvm-project/libcxx/include/__algorithm/ranges_swap_ranges.h | |
parent | 972a253a57b6f144b0e4a3e2080a2a0076ec55a0 (diff) | |
parent | 677727e8296a802385345db6fa65e68223f4597a (diff) |
Diffstat (limited to 'contrib/llvm-project/libcxx/include/__algorithm/ranges_swap_ranges.h')
-rw-r--r-- | contrib/llvm-project/libcxx/include/__algorithm/ranges_swap_ranges.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/ranges_swap_ranges.h b/contrib/llvm-project/libcxx/include/__algorithm/ranges_swap_ranges.h index 3254e1c60abb..d980fdec2c49 100644 --- a/contrib/llvm-project/libcxx/include/__algorithm/ranges_swap_ranges.h +++ b/contrib/llvm-project/libcxx/include/__algorithm/ranges_swap_ranges.h @@ -10,6 +10,8 @@ #define _LIBCPP___ALGORITHM_RANGES_SWAP_RANGES_H #include <__algorithm/in_in_result.h> +#include <__algorithm/iterator_operations.h> +#include <__algorithm/swap_ranges.h> #include <__config> #include <__iterator/concepts.h> #include <__iterator/iter_swap.h> @@ -38,12 +40,9 @@ struct __fn { requires indirectly_swappable<_I1, _I2> _LIBCPP_HIDE_FROM_ABI constexpr swap_ranges_result<_I1, _I2> operator()(_I1 __first1, _S1 __last1, _I2 __first2, _S2 __last2) const { - while (__first1 != __last1 && __first2 != __last2) { - ranges::iter_swap(__first1, __first2); - ++__first1; - ++__first2; - } - return {_VSTD::move(__first1), _VSTD::move(__first2)}; + auto __ret = std::__swap_ranges<_RangeAlgPolicy>( + std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2)); + return {std::move(__ret.first), std::move(__ret.second)}; } template <input_range _R1, input_range _R2> |