[rtsan] Remove mkfifoat interceptor (#116997)
[llvm-project.git] / libcxx / include / __cxx03 / __algorithm / ranges_shuffle.h
blob44e3a73e1b4b7740d8629ccee8becbe995b7b499
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 //===----------------------------------------------------------------------===//
9 #ifndef _LIBCPP___ALGORITHM_RANGES_SHUFFLE_H
10 #define _LIBCPP___ALGORITHM_RANGES_SHUFFLE_H
12 #include <__cxx03/__algorithm/iterator_operations.h>
13 #include <__cxx03/__algorithm/shuffle.h>
14 #include <__cxx03/__algorithm/uniform_random_bit_generator_adaptor.h>
15 #include <__cxx03/__config>
16 #include <__cxx03/__functional/invoke.h>
17 #include <__cxx03/__functional/ranges_operations.h>
18 #include <__cxx03/__iterator/concepts.h>
19 #include <__cxx03/__iterator/iterator_traits.h>
20 #include <__cxx03/__iterator/next.h>
21 #include <__cxx03/__iterator/permutable.h>
22 #include <__cxx03/__random/uniform_random_bit_generator.h>
23 #include <__cxx03/__ranges/access.h>
24 #include <__cxx03/__ranges/concepts.h>
25 #include <__cxx03/__ranges/dangling.h>
26 #include <__cxx03/__type_traits/remove_reference.h>
27 #include <__cxx03/__utility/forward.h>
28 #include <__cxx03/__utility/move.h>
30 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
31 # pragma GCC system_header
32 #endif
34 _LIBCPP_PUSH_MACROS
35 #include <__cxx03/__undef_macros>
37 #if _LIBCPP_STD_VER >= 20
39 _LIBCPP_BEGIN_NAMESPACE_STD
41 namespace ranges {
42 namespace __shuffle {
44 struct __fn {
45 template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Gen>
46 requires permutable<_Iter> && uniform_random_bit_generator<remove_reference_t<_Gen>>
47 _LIBCPP_HIDE_FROM_ABI _Iter operator()(_Iter __first, _Sent __last, _Gen&& __gen) const {
48 _ClassicGenAdaptor<_Gen> __adapted_gen(__gen);
49 return std::__shuffle<_RangeAlgPolicy>(std::move(__first), std::move(__last), __adapted_gen);
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 borrowed_iterator_t<_Range> operator()(_Range&& __range, _Gen&& __gen) const {
55 return (*this)(ranges::begin(__range), ranges::end(__range), std::forward<_Gen>(__gen));
59 } // namespace __shuffle
61 inline namespace __cpo {
62 inline constexpr auto shuffle = __shuffle::__fn{};
63 } // namespace __cpo
64 } // namespace ranges
66 _LIBCPP_END_NAMESPACE_STD
68 #endif // _LIBCPP_STD_VER >= 20
70 _LIBCPP_POP_MACROS
72 #endif // _LIBCPP___ALGORITHM_RANGES_SHUFFLE_H