xref: /freebsd-src/contrib/llvm-project/libcxx/include/__algorithm/ranges_partition_copy.h (revision 753f127f3ace09432b2baeffd71a308760641a62)
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_PARTITION_COPY_H
10 #define _LIBCPP___ALGORITHM_RANGES_PARTITION_COPY_H
11 
12 #include <__algorithm/in_out_out_result.h>
13 #include <__algorithm/make_projected.h>
14 #include <__algorithm/partition_copy.h>
15 #include <__config>
16 #include <__functional/identity.h>
17 #include <__functional/invoke.h>
18 #include <__functional/ranges_operations.h>
19 #include <__iterator/concepts.h>
20 #include <__iterator/iterator_traits.h>
21 #include <__iterator/projected.h>
22 #include <__ranges/access.h>
23 #include <__ranges/concepts.h>
24 #include <__ranges/dangling.h>
25 #include <__utility/forward.h>
26 #include <__utility/move.h>
27 
28 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
29 #  pragma GCC system_header
30 #endif
31 
32 #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
33 
34 _LIBCPP_BEGIN_NAMESPACE_STD
35 
36 namespace ranges {
37 
38 template <class _InIter, class _OutIter1, class _OutIter2>
39 using partition_copy_result = in_out_out_result<_InIter, _OutIter1, _OutIter2>;
40 
41 namespace __partition_copy {
42 
43 struct __fn {
44 
45   template <input_iterator _InIter, sentinel_for<_InIter> _Sent,
46             weakly_incrementable _OutIter1, weakly_incrementable _OutIter2,
47             class _Proj = identity, indirect_unary_predicate<projected<_InIter, _Proj>> _Pred>
48   requires indirectly_copyable<_InIter, _OutIter1> && indirectly_copyable<_InIter, _OutIter2>
49   _LIBCPP_HIDE_FROM_ABI constexpr
50   partition_copy_result<_InIter, _OutIter1, _OutIter2>
51   operator()(_InIter __first, _Sent __last, _OutIter1 __out_true, _OutIter2 __out_false,
52              _Pred __pred, _Proj __proj = {}) const {
53     // TODO: implement
54     (void)__first; (void)__last; (void)__out_true; (void)__out_false; (void)__pred; (void)__proj;
55     return {};
56   }
57 
58   template <input_range _Range, weakly_incrementable _OutIter1, weakly_incrementable _OutIter2,
59             class _Proj = identity, indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
60   requires indirectly_copyable<iterator_t<_Range>, _OutIter1> && indirectly_copyable<iterator_t<_Range>, _OutIter2>
61   _LIBCPP_HIDE_FROM_ABI constexpr
62   partition_copy_result<borrowed_iterator_t<_Range>, _OutIter1, _OutIter2>
63   operator()(_Range&& __range, _OutIter1 __out_true, _OutIter2 __out_false, _Pred __pred, _Proj __proj = {}) const {
64     // TODO: implement
65     (void)__range; (void)__out_true; (void)__out_false; (void)__pred; (void)__proj;
66     return {};
67   }
68 
69 };
70 
71 } // namespace __partition_copy
72 
73 inline namespace __cpo {
74   inline constexpr auto partition_copy = __partition_copy::__fn{};
75 } // namespace __cpo
76 } // namespace ranges
77 
78 _LIBCPP_END_NAMESPACE_STD
79 
80 #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
81 
82 #endif // _LIBCPP___ALGORITHM_RANGES_PARTITION_COPY_H
83