1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef _LIBCPP___ALGORITHM_RANGES_REMOVE_COPY_IF_H
10 #define _LIBCPP___ALGORITHM_RANGES_REMOVE_COPY_IF_H
12 #include <__algorithm/in_out_result.h>
13 #include <__algorithm/make_projected.h>
14 #include <__algorithm/remove_copy_if.h>
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>
28 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
29 # pragma GCC system_header
32 #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
34 _LIBCPP_BEGIN_NAMESPACE_STD
38 template <class _InIter, class _OutIter>
39 using remove_copy_if_result = in_out_result<_InIter, _OutIter>;
41 namespace __remove_copy_if {
45 template <input_iterator _InIter, sentinel_for<_InIter> _Sent, weakly_incrementable _OutIter,
46 class _Proj = identity, indirect_unary_predicate<projected<_InIter, _Proj>> _Pred>
47 requires indirectly_copyable<_InIter, _OutIter>
48 _LIBCPP_HIDE_FROM_ABI constexpr
49 remove_copy_if_result<_InIter, _OutIter>
50 operator()(_InIter __first, _Sent __last, _OutIter __result, _Pred __pred, _Proj __proj = {}) const {
52 (void)__first; (void)__last; (void)__result; (void)__pred; (void)__proj;
56 template <input_range _Range, weakly_incrementable _OutIter, class _Proj = identity,
57 indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
58 requires indirectly_copyable<iterator_t<_Range>, _OutIter>
59 _LIBCPP_HIDE_FROM_ABI constexpr
60 remove_copy_if_result<borrowed_iterator_t<_Range>, _OutIter>
61 operator()(_Range&& __range, _OutIter __result, _Pred __pred, _Proj __proj = {}) const {
63 (void)__range; (void)__result; (void)__pred; (void)__proj;
69 } // namespace __remove_copy_if
71 inline namespace __cpo {
72 inline constexpr auto remove_copy_if = __remove_copy_if::__fn{};
76 _LIBCPP_END_NAMESPACE_STD
78 #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
80 #endif // _LIBCPP___ALGORITHM_RANGES_REMOVE_COPY_IF_H