xref: /llvm-project/libcxx/include/__algorithm/ranges_stable_partition.h (revision 73ebcabff2d95d59b5ef05108738f2a2468cab12)
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_STABLE_PARTITION_H
10 #define _LIBCPP___ALGORITHM_RANGES_STABLE_PARTITION_H
11 
12 #include <__algorithm/make_projected.h>
13 #include <__algorithm/stable_partition.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 <__ranges/access.h>
23 #include <__ranges/concepts.h>
24 #include <__ranges/dangling.h>
25 #include <__ranges/subrange.h>
26 #include <__utility/forward.h>
27 #include <__utility/move.h>
28 
29 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
30 #  pragma GCC system_header
31 #endif
32 
33 #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
34 
35 _LIBCPP_BEGIN_NAMESPACE_STD
36 
37 namespace ranges {
38 namespace __stable_partition {
39 
40 struct __fn {
41 
42   template <bidirectional_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity,
43             indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
44   requires permutable<_Iter>
45   _LIBCPP_HIDE_FROM_ABI
46   subrange<_Iter> operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
47     // TODO: implement
48     (void)__first; (void)__last; (void)__pred; (void)__proj;
49     return {};
50   }
51 
52   template <bidirectional_range _Range, class _Proj = identity,
53             indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
54   requires permutable<iterator_t<_Range>>
55   _LIBCPP_HIDE_FROM_ABI
56   borrowed_subrange_t<_Range> operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
57     // TODO: implement
58     (void)__range; (void)__pred; (void)__proj;
59     return {};
60   }
61 
62 };
63 
64 } // namespace __stable_partition
65 
66 inline namespace __cpo {
67   inline constexpr auto stable_partition = __stable_partition::__fn{};
68 } // namespace __cpo
69 } // namespace ranges
70 
71 _LIBCPP_END_NAMESPACE_STD
72 
73 #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
74 
75 #endif // _LIBCPP___ALGORITHM_RANGES_STABLE_PARTITION_H
76