Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:21

0001 //===----------------------------------------------------------------------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_SET_INTERSECTION_H
0010 #define _LIBCPP___CXX03___ALGORITHM_RANGES_SET_INTERSECTION_H
0011 
0012 #include <__cxx03/__algorithm/in_in_out_result.h>
0013 #include <__cxx03/__algorithm/iterator_operations.h>
0014 #include <__cxx03/__algorithm/make_projected.h>
0015 #include <__cxx03/__algorithm/set_intersection.h>
0016 #include <__cxx03/__config>
0017 #include <__cxx03/__functional/identity.h>
0018 #include <__cxx03/__functional/invoke.h>
0019 #include <__cxx03/__functional/ranges_operations.h>
0020 #include <__cxx03/__iterator/concepts.h>
0021 #include <__cxx03/__iterator/mergeable.h>
0022 #include <__cxx03/__ranges/access.h>
0023 #include <__cxx03/__ranges/concepts.h>
0024 #include <__cxx03/__ranges/dangling.h>
0025 #include <__cxx03/__utility/move.h>
0026 
0027 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0028 #  pragma GCC system_header
0029 #endif
0030 
0031 _LIBCPP_PUSH_MACROS
0032 #include <__cxx03/__undef_macros>
0033 
0034 #if _LIBCPP_STD_VER >= 20
0035 
0036 _LIBCPP_BEGIN_NAMESPACE_STD
0037 
0038 namespace ranges {
0039 
0040 template <class _InIter1, class _InIter2, class _OutIter>
0041 using set_intersection_result = in_in_out_result<_InIter1, _InIter2, _OutIter>;
0042 
0043 namespace __set_intersection {
0044 
0045 struct __fn {
0046   template <input_iterator _InIter1,
0047             sentinel_for<_InIter1> _Sent1,
0048             input_iterator _InIter2,
0049             sentinel_for<_InIter2> _Sent2,
0050             weakly_incrementable _OutIter,
0051             class _Comp  = less,
0052             class _Proj1 = identity,
0053             class _Proj2 = identity>
0054     requires mergeable<_InIter1, _InIter2, _OutIter, _Comp, _Proj1, _Proj2>
0055   _LIBCPP_HIDE_FROM_ABI constexpr set_intersection_result<_InIter1, _InIter2, _OutIter> operator()(
0056       _InIter1 __first1,
0057       _Sent1 __last1,
0058       _InIter2 __first2,
0059       _Sent2 __last2,
0060       _OutIter __result,
0061       _Comp __comp   = {},
0062       _Proj1 __proj1 = {},
0063       _Proj2 __proj2 = {}) const {
0064     auto __ret = std::__set_intersection<_RangeAlgPolicy>(
0065         std::move(__first1),
0066         std::move(__last1),
0067         std::move(__first2),
0068         std::move(__last2),
0069         std::move(__result),
0070         ranges::__make_projected_comp(__comp, __proj1, __proj2));
0071     return {std::move(__ret.__in1_), std::move(__ret.__in2_), std::move(__ret.__out_)};
0072   }
0073 
0074   template <input_range _Range1,
0075             input_range _Range2,
0076             weakly_incrementable _OutIter,
0077             class _Comp  = less,
0078             class _Proj1 = identity,
0079             class _Proj2 = identity>
0080     requires mergeable<iterator_t<_Range1>, iterator_t<_Range2>, _OutIter, _Comp, _Proj1, _Proj2>
0081   _LIBCPP_HIDE_FROM_ABI constexpr set_intersection_result<borrowed_iterator_t<_Range1>,
0082                                                           borrowed_iterator_t<_Range2>,
0083                                                           _OutIter>
0084   operator()(_Range1&& __range1,
0085              _Range2&& __range2,
0086              _OutIter __result,
0087              _Comp __comp   = {},
0088              _Proj1 __proj1 = {},
0089              _Proj2 __proj2 = {}) const {
0090     auto __ret = std::__set_intersection<_RangeAlgPolicy>(
0091         ranges::begin(__range1),
0092         ranges::end(__range1),
0093         ranges::begin(__range2),
0094         ranges::end(__range2),
0095         std::move(__result),
0096         ranges::__make_projected_comp(__comp, __proj1, __proj2));
0097     return {std::move(__ret.__in1_), std::move(__ret.__in2_), std::move(__ret.__out_)};
0098   }
0099 };
0100 
0101 } // namespace __set_intersection
0102 
0103 inline namespace __cpo {
0104 inline constexpr auto set_intersection = __set_intersection::__fn{};
0105 } // namespace __cpo
0106 } // namespace ranges
0107 
0108 _LIBCPP_END_NAMESPACE_STD
0109 
0110 #endif // _LIBCPP_STD_VER >= 20
0111 
0112 _LIBCPP_POP_MACROS
0113 
0114 #endif // _LIBCPP___CXX03___ALGORITHM_RANGES_SET_INTERSECTION_H