]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/libcxx/include/__algorithm/ranges_shuffle.h
Merge llvm-project main llvmorg-15-init-16436-g18a6ab5b8d1f
[FreeBSD/FreeBSD.git] / contrib / llvm-project / libcxx / include / __algorithm / ranges_shuffle.h
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef _LIBCPP___ALGORITHM_RANGES_SHUFFLE_H
10 #define _LIBCPP___ALGORITHM_RANGES_SHUFFLE_H
11
12 #include <__algorithm/make_projected.h>
13 #include <__algorithm/shuffle.h>
14 #include <__config>
15 #include <__functional/identity.h>
16 #include <__functional/invoke.h>
17 #include <__functional/ranges_operations.h>
18 #include <__iterator/concepts.h>
19 #include <__iterator/iterator_traits.h>
20 #include <__iterator/permutable.h>
21 #include <__iterator/projected.h>
22 #include <__random/uniform_random_bit_generator.h>
23 #include <__ranges/access.h>
24 #include <__ranges/concepts.h>
25 #include <__ranges/dangling.h>
26 #include <__type_traits/remove_reference.h>
27 #include <__utility/forward.h>
28 #include <__utility/move.h>
29
30 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
31 #  pragma GCC system_header
32 #endif
33
34 #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
35
36 _LIBCPP_BEGIN_NAMESPACE_STD
37
38 namespace ranges {
39 namespace __shuffle {
40
41 struct __fn {
42
43   template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Gen>
44   requires permutable<_Iter> && uniform_random_bit_generator<remove_reference_t<_Gen>>
45   _LIBCPP_HIDE_FROM_ABI
46   _Iter operator()(_Iter __first, _Sent __last, _Gen&& __gen) const {
47     // TODO: implement
48     (void)__first; (void)__last; (void)__gen;
49     return {};
50   }
51
52   template<random_access_range _Range, class _Gen>
53   requires permutable<iterator_t<_Range>> && uniform_random_bit_generator<remove_reference_t<_Gen>>
54   _LIBCPP_HIDE_FROM_ABI
55   borrowed_iterator_t<_Range> operator()(_Range&& __range, _Gen&& __gen) const {
56     // TODO: implement
57     (void)__range; (void)__gen;
58     return {};
59   }
60
61 };
62
63 } // namespace __shuffle
64
65 inline namespace __cpo {
66   inline constexpr auto shuffle = __shuffle::__fn{};
67 } // namespace __cpo
68 } // namespace ranges
69
70 _LIBCPP_END_NAMESPACE_STD
71
72 #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
73
74 #endif // _LIBCPP___ALGORITHM_RANGES_SHUFFLE_H