diff options
author | Konstantin Varlamov <varconst@apple.com> | 2022-07-22 09:58:56 -0700 |
---|---|---|
committer | Konstantin Varlamov <varconst@apple.com> | 2022-07-22 09:59:13 -0700 |
commit | 14cf74d65d9f73e547fd97b00be878ac8e029a7e (patch) | |
tree | d82415cd6c91423b4f23e040a6e0331332c2b1fb /libcxx/include/algorithm | |
parent | 44f81dfba407c82589abbb5867714ad030d1b80c (diff) | |
download | llvm-14cf74d65d9f73e547fd97b00be878ac8e029a7e.zip llvm-14cf74d65d9f73e547fd97b00be878ac8e029a7e.tar.gz llvm-14cf74d65d9f73e547fd97b00be878ac8e029a7e.tar.bz2 |
[libc++][ranges] Implement `ranges::shuffle`.
Differential Revision: https://reviews.llvm.org/D130321
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 aea6ad8..5958ad1 100644 --- a/libcxx/include/algorithm +++ b/libcxx/include/algorithm @@ -710,6 +710,16 @@ namespace ranges { constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O> ranges::rotate_copy(R&& r, iterator_t<R> middle, O result); // since C++20 + template<random_access_iterator I, sentinel_for<I> S, class Gen> + requires permutable<I> && + uniform_random_bit_generator<remove_reference_t<Gen>> + I shuffle(I first, S last, Gen&& g); // Since C++20 + + template<random_access_range R, class Gen> + requires permutable<iterator_t<R>> && + uniform_random_bit_generator<remove_reference_t<Gen>> + borrowed_iterator_t<R> shuffle(R&& r, Gen&& g); // Since C++20 + template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2, class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> @@ -1603,6 +1613,7 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/ranges_set_intersection.h> #include <__algorithm/ranges_set_symmetric_difference.h> #include <__algorithm/ranges_set_union.h> +#include <__algorithm/ranges_shuffle.h> #include <__algorithm/ranges_sort.h> #include <__algorithm/ranges_sort_heap.h> #include <__algorithm/ranges_stable_partition.h> |