diff options
author | Nikolas Klauser <nikolasklauser@berlin.de> | 2022-02-10 13:33:03 +0100 |
---|---|---|
committer | Nikolas Klauser <nikolasklauser@berlin.de> | 2022-02-10 16:01:45 +0100 |
commit | 9d90531904983c1268cea6d56bfbc1ab2743ec23 (patch) | |
tree | e7fcd4903f4d2c6fd6129dcd088d4f3ad9cf2944 /libcxx/include/algorithm | |
parent | bd6c6974f5ea1626a6bb1b6adea59616d70ff3a8 (diff) | |
download | llvm-9d90531904983c1268cea6d56bfbc1ab2743ec23.zip llvm-9d90531904983c1268cea6d56bfbc1ab2743ec23.tar.gz llvm-9d90531904983c1268cea6d56bfbc1ab2743ec23.tar.bz2 |
[libc++][ranges] Implement std::ranges::swap_ranges()
Implement `std::ranges::swap_ranges()`
Reviewed By: Quuxplusone, #libc, ldionne
Spies: ldionne, mgorny, jloser, libcxx-commits
Differential Revision: https://reviews.llvm.org/D116303
Diffstat (limited to 'libcxx/include/algorithm')
-rw-r--r-- | libcxx/include/algorithm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm index 815f28e..21c0776 100644 --- a/libcxx/include/algorithm +++ b/libcxx/include/algorithm @@ -199,6 +199,16 @@ template <class ForwardIterator1, class ForwardIterator2> constexpr ForwardIterator2 // constexpr in C++20 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2); +template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2> + requires indirectly_swappable<I1, I2> + constexpr ranges::swap_ranges_result<I1, I2> + ranges::swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2); + +template<input_range R1, input_range R2> + requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>> + constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> + ranges::swap_ranges(R1&& r1, R2&& r2); + template <class ForwardIterator1, class ForwardIterator2> constexpr void // constexpr in C++20 iter_swap(ForwardIterator1 a, ForwardIterator2 b); @@ -739,6 +749,7 @@ template<class InputIterator, class OutputIterator> #include <__algorithm/pop_heap.h> #include <__algorithm/prev_permutation.h> #include <__algorithm/push_heap.h> +#include <__algorithm/ranges_swap_ranges.h> #include <__algorithm/remove.h> #include <__algorithm/remove_copy.h> #include <__algorithm/remove_copy_if.h> |