[rtsan] Remove mkfifoat interceptor (#116997)
[llvm-project.git] / libcxx / include / __cxx03 / __algorithm / ranges_prev_permutation.h
blob8d40d44e6ac1ee712954f4126857543a713650ae
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_PREV_PERMUTATION_H
10 #define _LIBCPP___ALGORITHM_RANGES_PREV_PERMUTATION_H
12 #include <__cxx03/__algorithm/in_found_result.h>
13 #include <__cxx03/__algorithm/iterator_operations.h>
14 #include <__cxx03/__algorithm/make_projected.h>
15 #include <__cxx03/__algorithm/prev_permutation.h>
16 #include <__cxx03/__config>
17 #include <__cxx03/__functional/identity.h>
18 #include <__cxx03/__functional/ranges_operations.h>
19 #include <__cxx03/__iterator/concepts.h>
20 #include <__cxx03/__iterator/sortable.h>
21 #include <__cxx03/__ranges/access.h>
22 #include <__cxx03/__ranges/concepts.h>
23 #include <__cxx03/__ranges/dangling.h>
24 #include <__cxx03/__utility/move.h>
25 #include <__cxx03/__utility/pair.h>
27 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
28 # pragma GCC system_header
29 #endif
31 _LIBCPP_PUSH_MACROS
32 #include <__cxx03/__undef_macros>
34 #if _LIBCPP_STD_VER >= 20
36 _LIBCPP_BEGIN_NAMESPACE_STD
38 namespace ranges {
40 template <class _InIter>
41 using prev_permutation_result = in_found_result<_InIter>;
43 namespace __prev_permutation {
45 struct __fn {
46 template <bidirectional_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
47 requires sortable<_Iter, _Comp, _Proj>
48 _LIBCPP_HIDE_FROM_ABI constexpr prev_permutation_result<_Iter>
49 operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
50 auto __result = std::__prev_permutation<_RangeAlgPolicy>(
51 std::move(__first), std::move(__last), std::__make_projected(__comp, __proj));
52 return {std::move(__result.first), std::move(__result.second)};
55 template <bidirectional_range _Range, class _Comp = ranges::less, class _Proj = identity>
56 requires sortable<iterator_t<_Range>, _Comp, _Proj>
57 _LIBCPP_HIDE_FROM_ABI constexpr prev_permutation_result<borrowed_iterator_t<_Range>>
58 operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
59 auto __result = std::__prev_permutation<_RangeAlgPolicy>(
60 ranges::begin(__range), ranges::end(__range), std::__make_projected(__comp, __proj));
61 return {std::move(__result.first), std::move(__result.second)};
65 } // namespace __prev_permutation
67 inline namespace __cpo {
68 constexpr inline auto prev_permutation = __prev_permutation::__fn{};
69 } // namespace __cpo
70 } // namespace ranges
72 _LIBCPP_END_NAMESPACE_STD
74 #endif // _LIBCPP_STD_VER >= 20
76 _LIBCPP_POP_MACROS
78 #endif // _LIBCPP___ALGORITHM_RANGES_PREV_PERMUTATION_H