Warning: This file is not a C or C++ file. It does not have highlighting.
| 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_SET_SYMMETRIC_DIFFERENCE_H |
| 10 | #define _LIBCPP___ALGORITHM_RANGES_SET_SYMMETRIC_DIFFERENCE_H |
| 11 | |
| 12 | #include <__algorithm/in_in_out_result.h> |
| 13 | #include <__algorithm/make_projected.h> |
| 14 | #include <__algorithm/set_symmetric_difference.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/mergeable.h> |
| 21 | #include <__ranges/access.h> |
| 22 | #include <__ranges/concepts.h> |
| 23 | #include <__ranges/dangling.h> |
| 24 | #include <__utility/move.h> |
| 25 | |
| 26 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 27 | # pragma GCC system_header |
| 28 | #endif |
| 29 | |
| 30 | _LIBCPP_PUSH_MACROS |
| 31 | #include <__undef_macros> |
| 32 | |
| 33 | #if _LIBCPP_STD_VER >= 20 |
| 34 | |
| 35 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 36 | |
| 37 | namespace ranges { |
| 38 | |
| 39 | template <class _InIter1, class _InIter2, class _OutIter> |
| 40 | using set_symmetric_difference_result = in_in_out_result<_InIter1, _InIter2, _OutIter>; |
| 41 | |
| 42 | struct __set_symmetric_difference { |
| 43 | template <input_iterator _InIter1, |
| 44 | sentinel_for<_InIter1> _Sent1, |
| 45 | input_iterator _InIter2, |
| 46 | sentinel_for<_InIter2> _Sent2, |
| 47 | weakly_incrementable _OutIter, |
| 48 | class _Comp = ranges::less, |
| 49 | class _Proj1 = identity, |
| 50 | class _Proj2 = identity> |
| 51 | requires mergeable<_InIter1, _InIter2, _OutIter, _Comp, _Proj1, _Proj2> |
| 52 | _LIBCPP_HIDE_FROM_ABI constexpr set_symmetric_difference_result<_InIter1, _InIter2, _OutIter> operator()( |
| 53 | _InIter1 __first1, |
| 54 | _Sent1 __last1, |
| 55 | _InIter2 __first2, |
| 56 | _Sent2 __last2, |
| 57 | _OutIter __result, |
| 58 | _Comp __comp = {}, |
| 59 | _Proj1 __proj1 = {}, |
| 60 | _Proj2 __proj2 = {}) const { |
| 61 | auto __ret = std::__set_symmetric_difference( |
| 62 | std::move(__first1), |
| 63 | std::move(__last1), |
| 64 | std::move(__first2), |
| 65 | std::move(__last2), |
| 66 | std::move(__result), |
| 67 | ranges::__make_projected_comp(__comp, __proj1, __proj2)); |
| 68 | return {std::move(__ret.__in1_), std::move(__ret.__in2_), std::move(__ret.__out_)}; |
| 69 | } |
| 70 | |
| 71 | template <input_range _Range1, |
| 72 | input_range _Range2, |
| 73 | weakly_incrementable _OutIter, |
| 74 | class _Comp = ranges::less, |
| 75 | class _Proj1 = identity, |
| 76 | class _Proj2 = identity> |
| 77 | requires mergeable<iterator_t<_Range1>, iterator_t<_Range2>, _OutIter, _Comp, _Proj1, _Proj2> |
| 78 | _LIBCPP_HIDE_FROM_ABI constexpr set_symmetric_difference_result<borrowed_iterator_t<_Range1>, |
| 79 | borrowed_iterator_t<_Range2>, |
| 80 | _OutIter> |
| 81 | operator()(_Range1&& __range1, |
| 82 | _Range2&& __range2, |
| 83 | _OutIter __result, |
| 84 | _Comp __comp = {}, |
| 85 | _Proj1 __proj1 = {}, |
| 86 | _Proj2 __proj2 = {}) const { |
| 87 | auto __ret = std::__set_symmetric_difference( |
| 88 | ranges::begin(__range1), |
| 89 | ranges::end(__range1), |
| 90 | ranges::begin(__range2), |
| 91 | ranges::end(__range2), |
| 92 | std::move(__result), |
| 93 | ranges::__make_projected_comp(__comp, __proj1, __proj2)); |
| 94 | return {std::move(__ret.__in1_), std::move(__ret.__in2_), std::move(__ret.__out_)}; |
| 95 | } |
| 96 | }; |
| 97 | |
| 98 | inline namespace __cpo { |
| 99 | inline constexpr auto set_symmetric_difference = __set_symmetric_difference{}; |
| 100 | } // namespace __cpo |
| 101 | } // namespace ranges |
| 102 | |
| 103 | _LIBCPP_END_NAMESPACE_STD |
| 104 | |
| 105 | #endif // _LIBCPP_STD_VER >= 20 |
| 106 | |
| 107 | _LIBCPP_POP_MACROS |
| 108 | |
| 109 | #endif // _LIBCPP___ALGORITHM_RANGES_SET_SYMMETRIC_DIFFERENCE_H |
| 110 |
Warning: This file is not a C or C++ file. It does not have highlighting.
