File indexing completed on 2026-05-03 08:13:21
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_SET_UNION_H
0010 #define _LIBCPP___CXX03___ALGORITHM_RANGES_SET_UNION_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_union.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/iterator_traits.h>
0022 #include <__cxx03/__iterator/mergeable.h>
0023 #include <__cxx03/__iterator/projected.h>
0024 #include <__cxx03/__ranges/access.h>
0025 #include <__cxx03/__ranges/concepts.h>
0026 #include <__cxx03/__ranges/dangling.h>
0027 #include <__cxx03/__utility/forward.h>
0028 #include <__cxx03/__utility/move.h>
0029
0030 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0031 # pragma GCC system_header
0032 #endif
0033
0034 _LIBCPP_PUSH_MACROS
0035 #include <__cxx03/__undef_macros>
0036
0037 #if _LIBCPP_STD_VER >= 20
0038
0039 _LIBCPP_BEGIN_NAMESPACE_STD
0040
0041 namespace ranges {
0042
0043 template <class _InIter1, class _InIter2, class _OutIter>
0044 using set_union_result = in_in_out_result<_InIter1, _InIter2, _OutIter>;
0045
0046 namespace __set_union {
0047
0048 struct __fn {
0049 template <input_iterator _InIter1,
0050 sentinel_for<_InIter1> _Sent1,
0051 input_iterator _InIter2,
0052 sentinel_for<_InIter2> _Sent2,
0053 weakly_incrementable _OutIter,
0054 class _Comp = ranges::less,
0055 class _Proj1 = identity,
0056 class _Proj2 = identity>
0057 requires mergeable<_InIter1, _InIter2, _OutIter, _Comp, _Proj1, _Proj2>
0058 _LIBCPP_HIDE_FROM_ABI constexpr set_union_result<_InIter1, _InIter2, _OutIter> operator()(
0059 _InIter1 __first1,
0060 _Sent1 __last1,
0061 _InIter2 __first2,
0062 _Sent2 __last2,
0063 _OutIter __result,
0064 _Comp __comp = {},
0065 _Proj1 __proj1 = {},
0066 _Proj2 __proj2 = {}) const {
0067 auto __ret = std::__set_union<_RangeAlgPolicy>(
0068 std::move(__first1),
0069 std::move(__last1),
0070 std::move(__first2),
0071 std::move(__last2),
0072 std::move(__result),
0073 ranges::__make_projected_comp(__comp, __proj1, __proj2));
0074 return {std::move(__ret.__in1_), std::move(__ret.__in2_), std::move(__ret.__out_)};
0075 }
0076
0077 template <input_range _Range1,
0078 input_range _Range2,
0079 weakly_incrementable _OutIter,
0080 class _Comp = ranges::less,
0081 class _Proj1 = identity,
0082 class _Proj2 = identity>
0083 requires mergeable<iterator_t<_Range1>, iterator_t<_Range2>, _OutIter, _Comp, _Proj1, _Proj2>
0084 _LIBCPP_HIDE_FROM_ABI constexpr set_union_result<borrowed_iterator_t<_Range1>, borrowed_iterator_t<_Range2>, _OutIter>
0085 operator()(_Range1&& __range1,
0086 _Range2&& __range2,
0087 _OutIter __result,
0088 _Comp __comp = {},
0089 _Proj1 __proj1 = {},
0090 _Proj2 __proj2 = {}) const {
0091 auto __ret = std::__set_union<_RangeAlgPolicy>(
0092 ranges::begin(__range1),
0093 ranges::end(__range1),
0094 ranges::begin(__range2),
0095 ranges::end(__range2),
0096 std::move(__result),
0097 ranges::__make_projected_comp(__comp, __proj1, __proj2));
0098 return {std::move(__ret.__in1_), std::move(__ret.__in2_), std::move(__ret.__out_)};
0099 }
0100 };
0101
0102 }
0103
0104 inline namespace __cpo {
0105 inline constexpr auto set_union = __set_union::__fn{};
0106 }
0107 }
0108
0109 _LIBCPP_END_NAMESPACE_STD
0110
0111 #endif
0112
0113 _LIBCPP_POP_MACROS
0114
0115 #endif